NAME

checkLogExist.pl - checks Log-entries at given times

SYNOPSIS

checkLogExist.pl

DESCRIPTION

checkLogExist is supposed to be called frequently in a separate timed job and checks if defined log entries exist in the defined log files, (hinting that the task was run/started), respectively whether the logfile exists at all. Missing logfiles or missing entries are being notified by e-mail, for multiple runs of checkLogExist already notified log check failures are stored to avoid too much error e-mails.

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} = {
 <nameOfJobscript.pl> => {
    errmailaddress => "test\@test.com",
    errmailsubject => "testjob failed",
    timeToCheck => "0800",
    freqToCheck => "B",
    logFileToCheck => "test.log",
    logcheck => "started.*",
    logRootPath => "optional alternate logfile path"
  },
 <...> => {
    
  },
}

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.

errmailaddress

where should the mail be sent to in case of non-existence of logfile/logline or an error in the script.

errmailsubject

subject-line for error mail, only used for error mail sending in the task scripts themselves.

timeToCheck

all checks earlier than this are ignored, given in format HHMM.

freqToCheck

ignore log check except on: ML..Monthend, D..every day, B..Business days, M1..Month-beginning, W{n}..Weekday (n:1=Sunday-7=Saturday)

logFileToCheck

Where (which logfile) should the job have written into ? this logfile is expected either in the logRootPath configured in site.config or in logRootPath configured for this locgcheck entry (see below).

logcheck

"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

logRootPath

instead of using the logRootPath configured in site.config, a special logRootPath can be optionally configured here for each log check.

checkLogExistDelay

hash of environment => delay entries, delay (in minutes) will be added to timeToCheck when checkLogExist is executed in this environment to cater for later executions in this environment

prodEnvironmentInSeparatePath

set to 1 if the production and other environments logs for this scriptname are in separate Paths defined by folderEnvironmentMapping (prod=root/Prod, test=root/Test, etc.), set to 0 if the production log is in the root folder and all other environments are below that folder (prod=root, test=root/Test, etc.)

splitcharacter

character being used to separate the log entries of this logfile into columns (date, user, process, message, etc.)

COPYRIGHT

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.