Logstash grok filter to tag received and bounced messages

前端 未结 1 1894
旧时难觅i
旧时难觅i 2020-12-21 18:58

Sthg makes me crazy, I would like to parse Postfix logs to know the status of emails, here is what I tried so far :

input {
   file {path => \"/var/log/ma         


        
相关标签:
1条回答
  • 2020-12-21 19:40

    I have found the problem.

    It's coming from this test:

    if [message] =~ /[ "bounced" ]/ {
      mutate {add_tag => [ "bounce" ]}
    }
    

    The regex is the part between the /, so your regex is evaluated like that : https://regex101.com/r/eaB5jp/2

    So all your lines will match and get the tag.

    In order to work, the test should be:

    if [message] =~ /bounced/ {
      mutate {add_tag => [ "bounce" ]}
    }
    
    0 讨论(0)
提交回复
热议问题