Logstash: how to use filter to match filename when using s3

后端 未结 3 1689
鱼传尺愫
鱼传尺愫 2021-01-14 21:44

I am new to logstash. I have some logs stored in AWS S3 and I am able to import them to logstash. My question is: is it possible to use the grok filter to add tags based on

3条回答
  •  孤街浪徒
    2021-01-14 22:28

    If you want to use tags based on filename, I think that this will work (I have not test it):

    filter {
      grok {
        match => [ "path", "%{GREEDYDATA:content}"]   
      }     
      mutate {
        add_tag => ["content"]
      }
    }
    

    "content" tag will be the filename, now it's up to you to modify the pattern to create differents tags with the specific part of the filename.

提交回复
热议问题