$inlin(), $inline(), $inputline()
(NOTE: Some of the techniques shown or described on this page--marked in purple--require new features in the latest official PIKT 1.19.0 release (pikt-current.tar.gz) that are unavailable in any previous version.)
DESCRIPTION
returns the current input line (without the trailing line-feed;
also available as the data values $inlin, $inline, and $inputline)
SYNOPSIS
$inlin()
$inline()
$inputline()
ARGUMENTS
none
EXAMPLES
notlogmsg ( #inputlength()
&& ($left($inline(),3) !~ "=months")
)
#ifdef debug
rule
output $inputline()
output "\#cpuid is $text(100*#cpuid,1)%"
quit
#endifdef
rule // report unusually high cpu usage
if #cpuid <= #cpuidlim
#if missioncritical
=hourly(output mail $inline() set #dotopps = #true(), )
#else
=every_four_hours(output mail $inline() set #dotopps = #true(), )
#endif
endif
rule
if $level() =~~ "emerg"
if $proc =~~ "(PROCS)"
=psheader
output mail =newline
output mail $inlin()
output mail "\%CPU $text(#cpu,1) >= (LIMEMERG),
PROPOSED ACTION: =kill -9 $PID"
else
=periodically(=psheader output mail =newline
output mail $inlin(), , #period)
fi
next
fi
piktlog_scan(A, B1, B2)
init
status =piktstatus
level =piktlevel
task "Scan the PIKT (A).log for noteworthy entries"
input logfile "=logdir/(A).log"
begin
=checkpoint(=lalim)
// assume no crisis (yet)
set #crisis = #false()
#if server
// on production servers, only process non-emergency pikt
// log files in the evening, during production downtime
if $alert() !~~ "red|emergency"
if #hour() < 18
quit
fi
fi
#endif
rule // automatic bypasses
if $inlin() =~~ "==> =logdir/.+ <=="
next
endif
rule // special alarm-specific bypasses, first bypass
if $inlin() =~~ "(B1)"
next
endif
rule // bypass empty lines
if ! #length($inlin())
next
endif
rule
=set_hr($inlin())
rule // report ERROR entries
if $inlin() =~ "ERROR]"
output mail $inlin()
// if ...
// =page()
//
next
endif
rule // report inactive alarms
if $inlin() =~ "INFO].+suspended status"
// && =monday
output mail $inlin()
next
endif
...
SEE ALSO
String Functions
Numerical Functions