4
responses
responses
Hi,
I am evaluating nxlog on Windows but I've run into a snag.
I have logs organized like this:
D:\ServerLogs\2015-07-16\*.log
Where the directory is rotated based on today's date. Now, if I use the recursive parameter set to true for the file watcher, including this
D:\ServerLogs\*.log
works. However, I don't want to include all files dues to size and/or relevance. I only want to include some of them. As far as I can gather, the recursive parameter only works when there's a wildcard on the filename.
What I need is to be able to include the following:
D:\ServerLogs\*\Log1.log
so it follows the directory rotation on that file alone. I can't figure out how to accomplish this with nxlog.
Please advise.
Thank you.
Comments (4)
While continuing the evaluation I find that I could theoretically check file_name() to see if it includes the files I want to log (drop() otherwise) and then do a recursive watch on *.log in the top directory.
Although this might fall in the "ugly hack" category, since certain non wanted logs can reach 1Gb+ and I don't know how nxlog likes that in terms of resource usage etc :)
Although I probably just made an even uglier hack :P
I created a small program that at midnight rewrites all directory timestamps in the nxlog.conf file to today's date and restarts the service.
So I decided to try out the filtering alternative, but it doesn't seem to work.
For example, if I have the following files
D:\ServerLogs\2015-07-16\Program.Notice.log
D:\ServerLogs\2015-07-16\Program.Warning.log
D:\ServerLogs\2015-07-16\Program.Error.log
and set the File directive to "D:\ServerLogs\*.log"
I just get
ERROR failed to open D:\ServerLog\*.log; The filename, directory name, or volume label syntax is incorrect.
I've tried with \\ to properly escape everything, but no luck. It doesn't even work if I set File to "D:\\ServerLogs\\2015-07-16\\*.log".
Can it have something to do with the multiple . in the file names?
I'm out of ideas.
Thanks.
See the note for the File directive in the manual.