I have a folder full of logs that have dynamic filenames that rotate out at various intervals.
Up to this point I've been using nxlog to track one specific file and I've been using the following directive:
Code: Select all
<Input mylogfile>
Module im_file
File 'C:\Path\To\My\Logs\mylogfile.log'
SavePos TRUE
Exec $Message = $raw_event;
</Input>
<Input mylogfile2>
Module im_file
File 'C:\Path\To\My\Logs\mylogfile2.log'
SavePos TRUE
Exec $Message = $raw_event;
</Input>If I have a wildcard situation, how do I distinguish which file the particular message came from. If I use the following directive, wouldn't all the messages found through this match appear as if they came from the same place? Is there a function (something in the Exec line, perhaps) which would capture the actual file name and send it as some field to Elasticsearch?
Code: Select all
<Input mylogs>
Module im_file
File 'C:\Path\To\My\Logs\*.log'
SavePos TRUE
Exec $Message = $raw_event;
</Input>And on a related note - how is nxlog's behavior with wildcard folders? I've read some threads I found through the googles where it would re-read old logs if no changes were made to that file - it would just continuously churn through the folder. I need to not get confused when files enter and leave the directory.
EDIT - I guess technically what I am asking is how do I fill the "program" field with nxlog from the filename while using a wildcard?
Thanks.