I am evaluating nxlog on Windows but I've run into a snag.

I have logs organized like this:


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


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:


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.

AskedJuly 16, 2015 - 11:21am

Comments (4)

  • phunqe's picture

    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 :)

  • phunqe's picture

    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.

  • phunqe's picture

    So I decided to try out the filtering alternative, but it doesn't seem to work.

    For example, if I have the following files




    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.



Answers (0)