Hey,
I'm wondering if there is anyway to tell what subdirectory/path to file is currently getting processed by Logstash when using the file input to look through a directory tree?
From what I understand I could parse my subdirectories in two ways given my setup, either using a recursive glob /path/to/top/directory/**/*.log
or using a direct wildcard path: /path/to/top/directory/*/*/*.log
Either way would be fine for me but what I really want is to know the current path that logstash is operating on. Essentially the subdirectory tells me a name of a server like this: /path/to/top/directory/server1/2018_03_21/foo.log
I then want to add a field with that server number in the file input block: add_field => {"server", "1"}
Is this possible using logstash? Is there someway I can access the path that is currently being processed? If I could get the path I could then use grok
to parse the server number into a variable and use that in add_field
Also, unfortunately I can't use filebeat in my setup.
Thanks!
Dave