Multiple patterns in one log

后端 未结 2 1170
借酒劲吻你
借酒劲吻你 2020-12-06 06:48

So I wrote now several patterns for logs which are working. The thing is now, that I have these multiple logs, with multiple patterns, in one single file. How does logstash

2条回答
  •  北海茫月
    2020-12-06 07:32

    Write the most specific grok first and use this syntax:

    grok {
        match => {
          "message" => [
          #Most specific grok:
            "%{TIMESTAMP_ISO8601:temp_date}%{SPACE}%{LOGLEVEL:log_level}%{UUID:user_id}",
          #Less specific:
            "%{TIMESTAMP_ISO8601:temp_date}%{SPACE}%{GREEDYDATA:log_message}"
         ]
      }
    }
    

提交回复
热议问题