pvl.syslog.parser: missing hostname in 'last message repeated ... times' messages
authorTero Marttila <terom@fixme.fi>
Fri, 04 Jan 2013 22:38:44 +0200
changeset 67 3324ed10c42f
parent 66 1e3a144f25c0
child 68 bea41de5cc98
pvl.syslog.parser: missing hostname in 'last message repeated ... times' messages
pvl/syslog/parser.py
--- a/pvl/syslog/parser.py	Fri Jan 04 22:32:14 2013 +0200
+++ b/pvl/syslog/parser.py	Fri Jan 04 22:38:44 2013 +0200
@@ -11,7 +11,9 @@
     # default syslogd format
     SYSLOG_RE = re.compile(
         # the timestamp+hostname header
-            r"(?P<timestamp>\w{3} [0-9 ]\d \d{2}:\d{2}:\d{2}) (?P<hostname>\S+) "
+        # XXX:  hostname may be missing
+        #       at least in Ubuntu 11.10 syslogd 'last message repeated 2 times'...
+            r"(?P<timestamp>\w{3} [0-9 ]\d \d{2}:\d{2}:\d{2}) (?P<hostname>\S+)? "
 
         # the message, including possible tag/pid
         +   r"(?P<message>(?P<tag>(?P<program>[^:\]]+)(?:\[(?P<pid>\d+)\])?: )?(?P<text>.*))\n?"