Logwatch - dynamically changing logfile names

Hello,

I would like to monitor logfiles of which names rotate every day, so the logfile name is like the current date plus a prefix. For example mylog-20-10-2022.log and so on. Is it possible to dynamically watch these logfiles without a need to add them every day again via manual discovery?

Regards
CheckMan

1 Like

Hi,

You can use logfile grouping.
In the config file for logwatch “logwatch.cfg” you configure the logfile name and W and C and so on as normal.
/logs/mylogs/mylog-*.log
W warnings
C critical

But instead of putting the full name you put “*” for the part of the logfile that changes.

Then you need to set up logfile grouping
Go to
Setup → Services → Service monitoring rules → Logfile Grouping

Create a rule with something like this
In the section “Logfile Grouping” you add a “pattern group”
Name of the group: My_multiple_logs (this is the name that you will see as a service in checkmk
Include pattern: /logs/mylogs/mylog-*.log (this is the same file name pattern that you set up in “logwatch.cfg”)

/ricardo

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.