Log collection from changing file names
I have logs that I need to collect with NxLog, these logs are in a .log file that has a name format [YYYY][MM][DD].request.log The log file name changes every day and if the logs roll over during the day they will be named with .request#.log
I need to capture [YYYY]-[MM]_[DD].request.log for the current date
For example today is Nov 18 2021 and I have these files 2021_11_18.request.log 2021_11_17.request.log 2021_11_16.request.log 2021_11_15.request.log
I would need to read 2021_11_18.request.log and ignore the rest
And tomorrow (Nov 19) I would need to read 2021_11_19.request.log
I already know how to read log files and send them to my syslog collector, my question is how can I get NxLog to only read the log from the current day?
You can use wildcards for the im_file module, which can help to read all the files in a folder with the specific names. The module is checking all the files at the applicable files at the start of the service, so if you have many files at the same place, I would recommend to apply some kind of log rotation.
You can find more information regarding the options at the following section of the manual: https://nxlog.co/docs/nxlog-ce/nxlog-reference-manual.html#im_file