From: Ian Jackson Date: Thu, 12 Oct 2017 17:42:23 +0000 (+0100) Subject: probes: logfile for easy viewing X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?a=commitdiff_plain;h=0841de1c733189f7e8e4edb46552ad1629fa129b;p=modbot-mtm.git probes: logfile for easy viewing --- diff --git a/crontab.part.INO b/crontab.part.INO index dc6fa01..82724bd 100644 --- a/crontab.part.INO +++ b/crontab.part.INO @@ -6,6 +6,7 @@ 50 7 * * 1 savelog -p live-%ABBREV%/xlog/log/%GROUP%/event.log 51 7 12 * * savelog -p live-%ABBREV%/errs 52 7 12 * * savelog -p live-%ABBREV%/webstump/log/webstump.log +52 7 12 * * savelog -p live-%ABBREV%/probes/log/log 53 7 * * 1 find live-%ABBREV%/xlog/log/%GROUP%/public -mtime +14 -type f -print0 | xargs -r0 rm -- 51 * * * * cd %BASEDIR% && probes/modrelays-probe all 3-59/5 * * * * cd %BASEDIR% && probes/modrelays-probe report diff --git a/probes/modrelays-probe b/probes/modrelays-probe index 80109e2..28db476 100755 --- a/probes/modrelays-probe +++ b/probes/modrelays-probe @@ -21,6 +21,7 @@ esac id=$(date +%s)_$$ statedir=probes/probes +logdir=probes/log lockfile=$statedir/.lock fail () { @@ -226,6 +227,10 @@ acquire_lock () { do-report-log () { # implicitly uses $outcome, $reported etc. - see maybe-report + mkdir -p $logdir + printf >>$logdir/log "%s: %s%s %s (%s)\n" \ + "$(date --iso-8601=seconds | sed 's/T/ /')" \ + "$outcome" "${reported:+ previously=}$reported" "$info" "$message" echo "$outcome" >"$attempt"/reported }