checkLogExist.pl - checks Log-entries at given times
checkLogExist.pl
checkLogExist should be called frequently in a separate job and checks if defined log entries exist in the defined log files, (hinting that the task was run/started), resp. whether the Logfile exists at all.
Configuration is done in sub-hash $config{checkLookup}, being the same place for the errmailaddress/errmailsubject of error mails being sent in the tasks themselves:
$config{checkLookup}
$config{checkLookup} = { <nameOfJobscript.pl> => { errmailaddress => "test\@test.com", errmailsubject => "testjob failed", timeToCheck => "0800", freqToCheck => "B", logFileToCheck => "test.log", logcheck => "started.*" }, <...> => { }, }
The key consists of the scriptname + any additional defined interactive options, which are being passed to the script in an alphabetically sorted manner. For checkLogExist.pl the key is irrelevant as all entries of $config{checkLookup} are worked through.
where should the mail sent to in case of non-existence or an error.
subject-line for error mail, only used for error mail sending in the tasks itself.
all checks earlier than this are ignored
ignore log check except on: ML..Monthend, D..every day, B..Business days, M1..Month-beginning, W{n}..Weekday (n:1=Sunday-7=Saturday)
Where (which logfile) should the job have written into ?
"regex keyword/expression" to compare the rows, if this is missing in the logfile after the current date/timeToCheck then an alarm is sent to the configured errmailaddress
Copyright (c) 2023 Roland Kapl
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install EAI::Wrap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm EAI::Wrap
CPAN shell
perl -MCPAN -e shell install EAI::Wrap
For more information on module installation, please visit the detailed CPAN module installation guide.