pvl.syslog.parser: missing hostname in 'last message repeated ... times' messages
--- 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?"