Variable Logfile Names
[posted 2007/04/17]
[Notes (edited slightly) issued with the release of PIKT 1.19.0pre4, which: implemented variable logfile names.]
For 'output log' statements, we have implemented computable logfile names. You are no longer forced to use a fixed logfile name string, for example,
output log "=logdir/SyslogKernelScan.log" $inlin
Instead, you could generalize this to, say,
output log "=logdir/" . $alarm() . ".log" $inlin
So if you used this macro
output_alarm_log(M) output log "=logdir/" . $alarm() . ".log" (M)
in the SyslogKernelScan alarm script, the logfile name would resolve to
output log "=logdir/SyslogKernelScan.log" $inlin
as above, but in the SyslogCriticalScan script, it would resolve to
output log "=logdir/SyslogCriticalScan.log" $inlin
and similarly for other Syslog*Scan scripts.
Computable logfile names open up all sorts of possibilities, for example,
output log "=logdir/" . $proc . $alarm() . "=piktalert=_.log" $inlin
which might result in a logfile named
/pikt/var/log/firefox-binRunawayCPUProcsStatsUrgent.log
or, instead of 'firefox-bin', some other arbitrary process name.
For more examples, see Developer's Notes.