[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CHECK FILE with script to determine filepath
From: |
Lutz Mader |
Subject: |
Re: CHECK FILE with script to determine filepath |
Date: |
Fri, 14 Dec 2018 10:18:52 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
Hello Marc,
monit doesn't handle varying log file namens.
check file Manager_Log with path "/var/log/em.log"
if not exist then exec "/usr/local/etc/monit/scripts/emlog.sh"
if size > 10 MB for 15 cycles then exec
"/usr/local/etc/monit/scripts/emlog.sh"
ignore match "^.*\[INFO\].*"
if match "^FATAL ERROR:.*" then exec
"/usr/local/etc/monit/scripts/emnotify.sh"
# if match "^.*\[ERROR\].*" then alert
group Manager
This is the way how monit handle logs, unfortunately there is no way to
handle log files with varying names or multiple log files in one step.
I try to handle this by using a script to create a link to the file with
the varying name in the past. But this is useful as long as the varying
log file will deleted or moved only.
check directory Log path "/var/log"
if changed timestamp then exec "/usr/local/etc/monit/scripts/linklog.sh"
group Manager
But I spend no time to write a script to handle directory changes to
detect/find new log files in the log folder and create a link.
No useful suggestion,
Lutz