--- a/pvl/syslog/rule.pp Thu Jan 10 17:51:53 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-class SyslogRule (SyslogFilter) :
- """
- A rule matches syslog lines, and formats them.
-
- tag - apply given tag to matches
- """
-
- def __init__ (self, tag, program=None, pattern=None, format=None, flags=None, **opts) :
- if pattern and not isinstance(pattern, re.RegexObject) :
- pattern = re.compile(pattern, flags)
-
- super(SyslogRule, self).__init__(prog=program)
-
- self.tag = tag
- self.format = format
- self.pattern = pattern
-
- def apply (self, item) :
- """
- Apply rule against given item.
- """
-
- # filter
- match = self.filter(item)
-
- if not match :
- # ignore
- return None
-
- match = self.pattern.match(item['msg'])
-
- if not match :
- # ignore
- return None
-
- # apply
- item.update(match.groupdict())
-
- if self.tag is False :
- # drop
- return False
-
- if self.format :
- # return
- return self.tag, self.format.format(**item)
-