[Logcheck-commits] r1528 - in logcheck/branches/1.3: debian src
madduck at users.alioth.debian.org
madduck at users.alioth.debian.org
Tue Mar 6 15:04:43 CET 2007
Author: madduck
Date: 2007-03-06 14:04:42 +0000 (Tue, 06 Mar 2007)
New Revision: 1528
Modified:
logcheck/branches/1.3/debian/changelog
logcheck/branches/1.3/src/logcheck
Log:
* Incorporate patch to improve handling of rotated logfiles
(closes: #336265).
Modified: logcheck/branches/1.3/debian/changelog
===================================================================
--- logcheck/branches/1.3/debian/changelog 2007-03-06 13:54:44 UTC (rev 1527)
+++ logcheck/branches/1.3/debian/changelog 2007-03-06 14:04:42 UTC (rev 1528)
@@ -1,8 +1,9 @@
logcheck (1.3~unreleased.1) unstable; urgency=low
- *
+ * Incorporate patch to improve handling of rotated logfiles
+ (closes: #336265).
- -- martin f. krafft <madduck at debian.org> Tue, 6 Mar 2007 13:53:32 +0000
+ -- martin f. krafft <madduck at debian.org> Tue, 6 Mar 2007 14:00:02 +0000
logcheck (1.2.56~unreleased.1) unstable; urgency=low
Modified: logcheck/branches/1.3/src/logcheck
===================================================================
--- logcheck/branches/1.3/src/logcheck 2007-03-06 13:54:44 UTC (rev 1527)
+++ logcheck/branches/1.3/src/logcheck 2007-03-06 14:04:42 UTC (rev 1528)
@@ -419,27 +419,29 @@
if [ -f "$file" ]; then
offsetfile="$STATEDIR/offset$(echo $file | tr / .)"
if [ -s "$offsetfile" -a -r "$offsetfile" ]; then
- if [[ $(wc -c < "$file") -lt $(tail -n 1 "$offsetfile") ]]; then
- # assume the log is rotated by savelog(8)
- # syslog-ng leaves old files here
- if [ -e "$file.0" -a "$file.0" -nt "$file.1.gz" ]; then
- debug "Running logtail on rotated: $file.0"
- $LOGTAIL -f "$file.0" -o "$offsetfile" $LOGTAIL_OPTS > \
- $TMPDIR/logoutput/$(basename "$file") 2>&1 \
- || error "Could not run logtail or save output"
- rm -f "$offsetfile" \
- || error "Could not remove $offsetfile"
- # assume the log is rotated by logrotate(8)
- # should also probably check if file is still fresh
- elif [ -e "$file.1" ]; then
- debug "Running logtail on rotated: $file.1"
- $LOGTAIL -f "$file.1" -o "$offsetfile" $LOGTAIL_OPTS > \
- $TMPDIR/logoutput/$(basename "$file") 2>&1 \
- || error "Could not run logtail or save output"
- rm -f "$offsetfile" \
- || error "Could not remove $offsetfile"
+ INODEOFFSET=$(head -n 1 < $offsetfile)
+ INODEFILE=$(stat --dereference --printf=%i $file)
+ if [[ $INODEFILE -ne $INODEOFFSET ]]; then
+ # assume the log is rotated by savelog(8)
+ # syslog-ng leaves old files here
+ if [ -e "$file.0" -a "$file.0" -nt "$file.1.gz" ]; then
+ debug "Running logtail on rotated: $file.0"
+ $LOGTAIL -f "$file.0" -o "$offsetfile" $LOGTAIL_OPTS > \
+ $TMPDIR/logoutput/$(basename "$file") 2>&1 \
+ || error "Could not run logtail or save output"
+ rm -f "$offsetfile" \
+ || error "Could not remove $offsetfile"
+ # assume the log is rotated by logrotate(8)
+ # should also probably check if file is still fresh
+ elif [ -e "$file.1" ]; then
+ debug "Running logtail on rotated: $file.1"
+ $LOGTAIL -f "$file.1" -o "$offsetfile" $LOGTAIL_OPTS > \
+ $TMPDIR/logoutput/$(basename "$file") 2>&1 \
+ || error "Could not run logtail or save output"
+ rm -f "$offsetfile" \
+ || error "Could not remove $offsetfile"
+ fi
fi
- fi
fi
debug "Running logtail: $file"
$LOGTAIL -f "$file" -o "$offsetfile" $LOGTAIL_OPTS \
More information about the Logcheck-commits
mailing list