Package: fai-client
Version: 4.0.8~deb7u1
Severity: normal
Tags: patch
The current implementation to shorten dmesg.log with logtail doesn't do what
it's supposed to do.
The procedure is as follows (if logtail is installed):
logtail -f /var/log/kern.log -o /var/run/fai/kern.log.offset
[...]
if [ -r /var/run/fai/kern.log.offset ] ; then
logtail -t -f /var/log/kern.log -o /var/run/fai/kern.log.offset >
$LOGDIR/dmesg.log
[...]
# [run save_dmesg a second time because there could be new kernel messages]
if [ -r /var/run/fai/kern.log.offset ] ; then
logtail -t -f /var/log/kern.log -o /var/run/fai/kern.log.offset >
$LOGDIR/dmesg.log
[...]
rm -f /var/run/fai/kern.log.offset
In words:
- create offset file (or: define a starting point in the logs)
- print everything which came up since defining the starting point without
changing the offset (twice)
- delete the offset file
So only messages which appear during the softupdate will be logged to
dmesg.log, but you actually want to get all the messages since the last
softupdate.
The attached patch implements this and also makes the logic a little bit easier
to understand (I think) -- the offset file will be kept after softupdates.
In contrast to the current implementation the offset file is saved to
/var/lib/fai, because we can't leave files in /var/run after the process has
terminated.
-- System Information:
Debian Release: 7.3
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.10.23.wap (SMP w/6 CPU cores)
Locale: LANG=en_GB.ISO-8859-15, LC_CTYPE=en_GB.ISO-8859-15 (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/dash
Versions of packages fai-client depends on:
ii file 5.11-2
ii iproute 20120521-3+b3
ii libapt-pkg-perl 0.1.26+b1
ii perl 5.14.2-21+deb7u1
Versions of packages fai-client recommends:
ii debconf-utils 1.5.49
pn libgraph-perl <none>
Versions of packages fai-client suggests:
ii logtail 1.3.15
-- Configuration Files:
/etc/fai/fai.conf changed [not included]
-- no debconf information
--- fai.orig 2013-09-23 09:54:51.000000000 +0200
+++ fai 2014-01-15 17:33:36.854516640 +0100
@@ -308,9 +308,6 @@
mkdir -p $LOGDIR
ln -snf $action-$fai_rundate $LOGDIR/../last-$action
ln -snf $action-$fai_rundate $LOGDIR/../last
- if [ -x /usr/sbin/logtail ] ; then
- logtail -f /var/log/kern.log -o /var/run/fai/kern.log.offset > /dev/null
- fi
fi
chown root:adm $LOGDIR
chmod 0750 $LOGDIR
--- subroutines.orig 2014-01-15 17:34:00.292543792 +0100
+++ subroutines 2014-01-15 17:34:07.021550939 +0100
@@ -119,8 +119,8 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
save_dmesg() {
- if [ -r /var/run/fai/kern.log.offset ] ; then
- logtail -t -f /var/log/kern.log -o /var/run/fai/kern.log.offset > $LOGDIR/dmesg.log
+ if [ -x /usr/sbin/logtail ] ; then
+ logtail -f /var/log/kern.log -o /var/lib/fai/kern.log.offset >> $LOGDIR/dmesg.log
else
dmesg > $LOGDIR/dmesg.log
fi
@@ -492,7 +492,6 @@
task_savelog() {
mkdir -p $FAI_ROOT/var/{lib,log}/fai
- rm -f /var/run/fai/kern.log.offset
fai-savelog -l
[ -f $LOGDIR/FAI_CLASSES ] && cp -pu $LOGDIR/FAI_CLASSES $FAI_ROOT/var/lib/fai
[ -f $LOGDIR/disk_var.sh ] && cp -pu $LOGDIR/disk_var.sh $FAI_ROOT/var/lib/fai