0

I have the following folder structure:

-job-folders
    -1
        -log.txt
    -2
        -log.txt
    -3  
        -log.txt

I want to do watch log.txt in all of the above job folders. I am currently using:

<Input my-log>
    Module im_file
    File "C:\job-folders\*\log.txt"  
    SavePos TRUE
    Recursive TRUE
</Input>

In nxlog.log, I get

2015-12-21 12:10:25 ERROR apr_stat failed on file C:\job-folders\*\log.txt; The filename, directory name, or volume label syntax is incorrect.

I know it says explicitly that directory names cannot be wildcarded at https://nxlog.co/docs/en/nxlog-reference-manual.html#im_file_config_file

Is there a way around this?

Lloyd Banks
  • 35,740
  • 58
  • 156
  • 248

1 Answers1

6

The pattern I was looking for was

File "C:\job-folders\\\*log.txt"

Lloyd Banks
  • 35,740
  • 58
  • 156
  • 248
  • 1
    With the Recursive option enabled (which is the default) it will look into subfolders for "*log.txt" – b0ti Dec 22 '15 at 10:25
  • The same works for linux based installations too. Setting the file path to /var/log/elasticsearch/*ecs_product_head_index_search_slowlog.log in the configuration did the trick. – kirancodify Jun 06 '18 at 15:20
  • Thanks @Lloyd you helped me a lot. Nxlog be like : "oh you just need to escape 11 times to make it works, have you tried \\\\\\\\\\*.txt ?" – MedAl May 12 '21 at 13:27