Package: syslog-summary
Version: 1.14-2.1
Severity: important
Tags: patch upstream

Dear Maintainer,

   * What led up to the situation?

        ** syslog file containing multiple INFO lines following each
        other
        ** ignore pattern to block INFO lines in
        /etc/syslog-summary/ignore.rules.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

        run syslog-summary on this file

   * What was the outcome of this action?

        about half of the INFO lines are not ignored and output in the
        summary

   * What outcome did you expect instead?

        no INFO lines in the summary output


   * Patch

        There are 2 PR against upstream to fix this (I was a bit eager
        to fix this...) [0,1], the oldest 5 years old.

        My proposed patch [1] is at the end of this report, but [0] is a
        one-line change.

        [0] https://github.com/dpaleino/syslog-summary/pull/1
        [1] https://github.com/dpaleino/syslog-summary/pull/3

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages syslog-summary depends on:
pn  python:any  <none>

Versions of packages syslog-summary recommends:
ii  python-magic  1:5.29-2

syslog-summary suggests no packages.

-- Configuration Files:
/etc/syslog-summary/ignore.rules changed [not included]

-- no debconf information

>From cb5748700d9f9d42b8680fa1ef3cc232df97823a Mon Sep 17 00:00:00 2001
From: Olivier Mehani <sht...@ssji.net>
Date: Mon, 9 Jan 2017 21:16:33 +1100
Subject: [PATCH] Fix ignore logic

The previous structure failed to ignore two lines in a row.

Signed-off-by: Olivier Mehani <sht...@ssji.net>
---
 syslog-summary | 47 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/syslog-summary b/syslog-summary
index 17ad38b..8ffb27b 100755
--- a/syslog-summary
+++ b/syslog-summary
@@ -197,31 +197,30 @@ def summarize(filename, states):
                        ignored_count += 1
                        if DEBUG:
                                print "Ignoring: %s" % line
-                       line = file.readline()
-               
-               date, rest = split_date(line)
-               if date:
-                       found = pidpat.search(rest)
-                       if found:
-                               rest = found.group(1) + ": " + 
rest[found.end():]
-
-               count = 1
-               repeated = None
-               if REPEAT:
-                       repeated = repeatpat.search(rest)
-               if repeated and previous:
-                       count = int(repeated.group(1))
-                       rest = previous
-
-               if counts.has_key(rest):
-                       counts[rest] = counts[rest] + count
                else:
-                       assert count == 1
-                       counts[rest] = count
-                       order.append(rest)
-
-               if not repeated:
-                       previous = rest
+                       date, rest = split_date(line)
+                       if date:
+                               found = pidpat.search(rest)
+                               if found:
+                                       rest = found.group(1) + ": " + 
rest[found.end():]
+       
+                       count = 1
+                       repeated = None
+                       if REPEAT:
+                               repeated = repeatpat.search(rest)
+                       if repeated and previous:
+                               count = int(repeated.group(1))
+                               rest = previous
+       
+                       if counts.has_key(rest):
+                               counts[rest] = counts[rest] + count
+                       else:
+                               assert count == 1
+                               counts[rest] = count
+                               order.append(rest)
+       
+                       if not repeated:
+                               previous = rest
                line = file.readline()
        file.close()
 
-- 
2.11.0

Reply via email to