4
responses

HI,

Is there any solution to use wildcard chars in the path in the file input setting?

I have these folders:
/path/to/logs/t-01test/log/app.log
/path/to/logs/t-02apple/log/app_20200427.log
/path/to/logs/t-03horse/log/app.log
/path/to/logs/t-04table/log/app.log

I used this input settings:

<Input in_app>
Module im_file
File "/path/to/logs/t-*/log/app*.log"
SavePos TRUE
InputType LineBased
</Input>

I always get the ERROR failed to open directory: /path/to/logs/t-*/logs: No such file or directory

I used this setting before:
<Input in_app>
Module im_file
File "/path/to/logs/*app*.log"
SavePos TRUE
InputType LineBased
</Input>

This is working correctly but we have added some folders under the /path/to/logs/t-01test/ where the nxlog user cant read for security reasons.
The nxlog log is full with errors because of enough rights:
ERROR failed to open directory: path/to/logs/t-01test/conf: Permission denied

Is it allowed to use wildcards in the path?

Thanks!

AskedApril 27, 2020 - 1:45pm

Answer (1)

Hello,

Yeas, wildcard are allowed in File directive. But yes, you need to doublecheck permissions in your case and maybe configure Path somehow differently.
https://nxlog.co/docs/nxlog-ce/nxlog-reference-manual.html#im_file_config

Regards, Arch

Comments (3)

  • Zola's picture

    Hi Arch!

    Thanks for your answer!
    I used this documentation but without success.
    Can you explain what can I use instead of this setting?

    File "/path/to/logs/t-*/log/app*.log"

    Thx!

  • manuel.munoz's picture
    (NXLog)

    Zola, wildcards are not allowed in directory names...

    Wildcards are supported in filenames only, directory names in the path cannot be wildcarded. Wildcards are not regular expressions, but are patterns commonly used by Unix shells to expand filenames (also known as "globbing").