Search code examples
linuxsyslog

I wonder how to add recursively logfiles to syslog?


My need is to send all /var/log/[dir]/*.log files to the rsylog.conf file while i cannot guess what [dir] is or [dir]s are.

I followed https://stackoverflow.com/a/67127263/1469161

I can send /var/log/*/*.log into a list and configure rsylog.conf via a script and then restart the rsyslogd service.

Is it possible to do it dynamically, or recursively into rsylog.conf ?

I can resume : How to add files to the imfile module recursively ?


Solution

  • Sorry :( But it cannot be done yet :

    Any plans on adding support for recursive wildcards in path?

    actually not - it will further complicate already complex code AND drags quite some performance. Note that we need to keep watches on all and every directories in between. I admit I also do not fully understand why such a feature may really be needed. If there is a hard need, it can of course be done. Maybe even as a sponsored project.

    Once it's said :

    • In order to catch the legacy log stack, I listed all files (from a python script), and for each I use the logger command with decent options to send them directly to the network based syslog aggregator and I verify each line exists in the target database and then delete the .log(.gz) file.
    • In order to let the live log stack, I listed all files with an anacron line and I add all files to the syslog appender.

    Done this way. I'll see if journald can handle such a situation.