--- syslog-summary-1.14/syslog-summary +++ syslog-summary-1.14/syslog-summary.new @@ -4,22 +4,22 @@ # Copyright © 2008-2009, David Paleino # © 2001-2008, Tommi Virtanen # © 1998-2000, Lars Wirzenius -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. -# +# # This program 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 General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. - + """Summarize the contents of a syslog log file. The syslog(3) service writes system log messages in a certain format: @@ -139,10 +139,10 @@ return False except: from os.path import splitext - + if not QUIET: print "Using fallback detection... please install python-magic for better gzip detection." - + if splitext(filename)[1] == ".gz": return True else: @@ -154,7 +154,7 @@ ignored_count = 0 if not QUIET: print "Summarizing %s" % filename - + # If the file is a gzipped log, open it # using the proper function from the gzip # module. @@ -165,7 +165,7 @@ file = open(filename, "r") except IOError, e: io_error(e, filename, True) - + linecount = 0 shaobj = sha1() @@ -193,13 +193,13 @@ # foo+=1 shaobj.update(line) linecount += 1 - + if should_be_ignored(line): ignored_count += 1 if DEBUG: print "Ignoring: %s" % line line = file.readline() - + date, rest = split_date(line) if date: found = pidpat.search(rest) @@ -232,7 +232,7 @@ # print foo states[filename] = (linecount + ignored_count, shaobj.hexdigest()) # print states - + if QUIET and order: print "Summarizing %s" % filename if not QUIET or order: