check_logfiles icon indicating copy to clipboard operation
check_logfiles copied to clipboard

How to get yesterday's log file date

Open bsivavani opened this issue 8 years ago • 2 comments

Hi,

We are trying to monitor log file today which is having yesterday's date (log_2017_09_23.txt)

Currently we have below Macro to get today's date, but unfortunately we need similar Macro to find yesterday's date. logfile => '$LOGDIR$/log_$CL_DATE_YYYY$$CL_DATE_MM$$CL_DATE_DD$.txt',

Kindly let us know if there is any way to get yesterday's date.

Thanks

bsivavani avatar Sep 24 '17 13:09 bsivavani

Hi, do your logfiles look identically? So that every day one of them is created with a filename like YYYMMDD? (no matter if the newest logfile has yesterday's date in the filename). I just want to know if they are in one directory and have a uniform name.

lausser avatar Sep 24 '17 15:09 lausser

.... logfile => '$LOGDIR$/dummy', rotation => 'log_\d\d\d\d_\d\d_\d\d.txt', type => 'rotating::uniform', ... With this setting, check_logfiles takes all files in $LOGFILE$/*, selects those which match the rotation-pattern and treats the file with the most recent modification time as the current logfile, all the others as rotated archives.

lausser avatar Sep 24 '17 18:09 lausser