云数据迁移 CDM-正则表达式分隔半结构化文本:Log4J日志

时间:2024-10-10 17:12:17

Log4J日志

  • 日志样例:
    2018-01-11 08:50:59,001 INFO  [org.apache.sqoop.core.SqoopConfiguration.configureClassLoader(SqoopConfiguration.java:251)] Adding jars to current classloader from property: org.apache.sqoop.classpath.extra
  • 正则表达式为:
    ^(\d.*\d) (\w*)  \[(.*)\] (\w.*).*
  • 解析出的结果如下:
    表1 Log4J日志解析结果

    列号

    样值

    1

    2018-01-11 08:50:59,001

    2

    INFO

    3

    org.apache.sqoop.core.SqoopConfiguration.configureClassLoader(SqoopConfiguration.java:251)

    4

    Adding jars to current classloader from property: org.apache.sqoop.classpath.extra

support.huaweicloud.com/bestpractice-cdm/cdm_01_0098.html