Extract path in logstash

Hello every one
I need to access to my filename date.
this is the filter i wrote in my logstash

filter {
    grok {
        match => { "path" => [ "^%{GREEDYDATA}(?<year>[0-9]{4})(?<month>[0-9]{2})(?<day>[0-9]{2})(?<hour>[0-9]{4})%{GREEDYDATA}" ] }
      }
}

and this is the output of my file path "path" => "/etc/logstash/conf.d/myfile/202005020759.txt"
but nothing appear to my logstash output as a field of year month and day..even i tried this:

filter {
    grok {
        match => { "path" => [ "%{GREEDYDATA:some}" ] }
      }
}

but still no out put in my logstash.
i check everything on internet but still no luck

What does your raw incoming message look like and what is the output you are using?

Thanks a lot for your reply..actually i found my mistake..i was shipping my log from filebeat so the path of file must be : [log][file][path] not path

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.