数据治理中心 DATAARTS STUDIO-正则表达式分隔半结构化文本:Log4J日志

时间:2024-11-12 17:24:52

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-dataartsstudio/dataartsstudio_05_0014.html