Logback.xml

filter {
  multiline {
  pattern => '^(?m)\[%{TIMESTAMP_ISO8601}\] \[%{HOSTNAME}\] \[%{DATA}\] %{LOGLEVEL} '
  negate => true
  what => previous
  }
   
  grok {
  pattern => [
  "(?m)\[%{TIMESTAMP_ISO8601:timestamp}\] \[%{HOSTNAME:host}\] \[%{DATA:thread}\] %{LOGLEVEL:logLevel} %{DATA:class}@%{DATA:method}:%{DATA:line} \- %{GREEDYDATA:message}"
  ]
   
  overwrite => [
  "host",
  "message"
  ]
   
  add_field => {
  "code" => "%{class}@%{method}:%{line}"
  }
  }
   
  if "_grokparsefailure" in [tags] {
  grok {
  match => [
  "message", "(?m)\[%{TIMESTAMP_ISO8601:timestamp}\] \[%{HOSTNAME:host}\] \[%{DATA:thread}\] %{LOGLEVEL:logLevel} %{DATA:class}@%{DATA:method}:%{DATA:line} \- (?<message>(.|\r|\n)*)"
  ]
  overwrite => [
  "host",
  "message"
  ]
  add_field => {
  "code" => "%{class}@%{method}:%{line}"
  }
  }
  }
   
  date {
  match => [
  "timestamp" , "YYYY-MM-dd HH:mm:ss.SSS"
  ]
  target => "@timestamp"
  }
  }
posted on 2018-09-26 10:09  kelisi_king  阅读(141)  评论(0编辑  收藏  举报