Example #1
0
 def test_and(self):
     exclusion = Exclusion({'MESSAGE': ['exclude this'],
                            'SYSLOG_IDENTIFIER': ['from this']})
     assert exclusion.matches({'MESSAGE': 'exclude this',
                               'SYSLOG_IDENTIFIER': 'from this',
                               'IGNORE': 'ignore this'})
     assert not exclusion.matches({'MESSAGE': 'exclude this'})
Example #2
0
 def test_regexp(self):
     exclusion = Exclusion({'MESSAGE': ['/exclude/'],
                            'FIELD': ['/exclude/']})
     assert exclusion.matches({'MESSAGE': 'exclude this',
                               'FIELD': 'exclude this'})
     assert not exclusion.matches({'MESSAGE': 'do not exclude',
                                   'FIELD': 'do not exclude'})
     assert not exclusion.matches({'MESSAGE': 'exclude',
                                   'FIELD': 1})
Example #3
0
 def test_priority(self):
     exclusion = Exclusion({'PRIORITY': 'err'})
     priority_type = journal.DEFAULT_CONVERTERS.get('PRIORITY', str)
     assert exclusion.matches({'PRIORITY': priority_type(3)})
Example #4
0
 def test_or(self):
     exclusion = Exclusion({'MESSAGE': ['exclude this', 'or this']})
     assert exclusion.matches({'MESSAGE': 'exclude this',
                               'IGNORE': 'ignore this'})
     assert not exclusion.matches({'MESSAGE': 'not this',
                                   'IGNORE': 'ignore this'})