Closed jbeaujour closed 6 years ago
Sorry, you cant't mix config file and cmdline Parameter.
What you can do: ` @searches = ( { template => 'test', logfile => '/var/log/$CL_TAG$.log', criticalpattern => '4097.*generated an application error', },
` (it's template instead of tag). Then, run check_logfiles --config ... --tag myapplication
$CL_TAG$ will be replaced in the logfile attribute as well as in critical/warningpatterns. So you can use this to modify one configfile at runtime.
Thank's It Work's !!! But i have a postcript who's wrong: $postscript = sub {
if ($ENV{CHECK_LOGFILES_SERVICESTATEID} == 2) {
printf "$ENV{CHECK_LOGFILES_SERVICEOUTPUT}, controler $ENV{CHECK_LOGFILES_TAG}";
return 2;
} elsif ($ENV{CHECK_LOGFILES_SERVICESTATEID} == 0) {
printf "$ENV{CHECK_LOGFILES_SERVICEOUTPUT}, statut de $ENV{CHECK_LOGFILES_TAG} OK";
return 0;
} else
{
printf "ESB : Statut inconnu, consulter le fichier de log $ENV{CHECK_LOGFILES_TAG}";
return 3;
}
};
It return "postcript" instead of "$tag" in all state: "... controler postscript ...." In the past, we use $ENV{CHECK_LOGFILES_LOGDIR}/$ENV{CHECK_LOGFILES_LOGFILE} who works fine Is there a bug in my code ?
In fact, we use $ENV{CHECK_LOGFILES_MY_LOGDIR}/$ENV{CHECK_LOGFILES_MY_LOGFILE} who works fine MY_LOGDIR and MY_LOGFILE was personnal macros with static data in config files Is there a bug in the new code of my config file ?
Hello, I would use check_logfiles with command line parameter --logfile both with --config, and use a var in the config file for re-use the logfile name. I don't find documentation for what kind of var in @searches :