Zoe Parsons
2007-Sep-09 11:37 UTC
[Logcheck-devel] Bug#441388: logtail2 doesn't work if no archived logs found
Package: logtail Version: 1.2.61 Severity: important Recently logcheck stopped working on my system and after running it manually I traced it to logtail2... I'd recently been forced to delete the archived logs on my system in order to make some space and that appears to confuse logtail2 completely... e.g.: root at macaroni:~# logtail2 -t /var/log/syslog Cannot get /var/log/syslog.1.gz mtime: No such file or directory If I create that file it then works fine. I'm not sure why it needs to have that file existing in the first place and surely this will break new systems which haven't rotated any logs yet? -- System Information: Debian Release: lenny/sid APT prefers testing-proposed-updates APT policy: (500, 'testing-proposed-updates'), (500, 'proposed-updates'), (500, 'testing') Architecture: i386 (i686) Kernel: Linux 2.6.22-1-k7 (SMP w/1 CPU core) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages logtail depends on: ii perl 5.8.8-7 Larry Wall's Practical Extraction logtail recommends no packages. -- no debconf information
Marc Haber
2007-Sep-09 14:58 UTC
[Logcheck-devel] Bug#441388: Bug#441388: logtail2 doesn't work if no archived logs found
On Sun, Sep 09, 2007 at 12:37:17PM +0100, Zoe Parsons wrote:> root at macaroni:~# logtail2 -t /var/log/syslog > Cannot get /var/log/syslog.1.gz mtime: No such file or directoryDoes the following patch help? diff -urN logcheck-1.2.61/src/detectrotate/10-savelog.dtr logcheck/src/detectrotate/10-savelog.dtr --- logcheck-1.2.61/src/detectrotate/10-savelog.dtr 2007-08-23 13:44:27.000000000 +0200 +++ logcheck/src/detectrotate/10-savelog.dtr 2007-09-09 16:56:59.000000000 +0200 @@ -3,7 +3,7 @@ sub { my ($filename) = @_; my $rotated_filename=""; - if (-e "$filename.0" && (mtime("$filename.0") > mtime("$filename.1.gz")) ) { + if (-e "$filename.0" && -e "$filename.1.gz" && (mtime("$filename.0") > mtime("$filename.1.gz")) ) { # assume the log is rotated by savelog(8) # syslog-ng leaves old files here $rotated_filename="$filename.0"; diff -urN logcheck-1.2.61/src/logtail2 logcheck/src/logtail2 --- logcheck-1.2.61/src/logtail2 2007-08-23 13:44:27.000000000 +0200 +++ logcheck/src/logtail2 2007-09-09 16:58:00.000000000 +0200 @@ -122,7 +122,7 @@ #} else { # print "no rotated file found\n"; #} - if ($rotated_filename && inode($rotated_filename) == $inode) { + if ($rotated_filename && -e "$rotated_filename" && inode($rotated_filename) == $inode) { return $rotated_filename; } else { return ""; Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190