A Linux kernel log preprocessing tool.
Compilation generates a rational_printk
kernel module that can be
inserted or removed at any time. The kernel module parses the output
of the kernel routine printk
such that the message's string format
specifier is output as item 0:
and the arguments as items 1:
, 2:
, ...
The output will also be prepended by RPKJOBID jobid
, where jobid
is the value placed in the /sys/module/rational_printk/parameters/JOBID
pseudofile. An example of the output message generated by the kernel is
Aug 4 14:38:52 c557-302 kernel: RPKJOBID 7457614 0: %s: port %d(%s) entering %s state 1: <6> 2: br0 3: 1 4: mic0 5: forwarding
The build script tacc_logs/rpk/build_rpk
is provided.
After running build_rpk
the rpm rational_printk-1.0.0-1.x86_64.rpm
is generated. This can then be installed in the usual way. Installation
automatically loads the module.
To label log entries with jobid use
echo JOBID > /sys/module/rational_printk/parameters/JOBID
before a job begins. Note
echo 0 > /sys/module/rational_printk/parameters/JOBID
upon job completion is then necessary.
On the compute nodes add the following lines to /etc/rsyslog.conf
# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf
and a conf file in /etc/rsyslog.d/
with the content (for example)
if $msg contains 'RPKJOBID' then @serverdomainname
&~
On the server where the logs will be hosted add the following lines to /etc/rsyslog.conf
# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf
with the following conf file in /etc/rsyslog.d/
$template RemoteHost,"/var/rpk/stampede/syslog/%$YEAR%/%$MONTH%/%$DAY%/%HOSTNAME%.log"
$Ruleset remote
*.* ?RemoteHost
#if $msg contains 'RPKJOBID' then /var/log/rpk.log
#if $msg contains 'JobID' then /var/log/rpk.log
$Ruleset RSYSLOG_DefaultRuleset
# provides UDP syslog reception
$ModLoad imudp
$InputUDPServerBindRuleset remote
$UDPServerRun 514
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA