sawmill.filterer.item

class sawmill.filterer.item.Item(key, value, mode='include')[source]

Bases: sawmill.filterer.base.Filterer

Filter logs based on key, value item matching.

__init__(key, value, mode='include')[source]

Initialise filterer with key and value to test against.

mode can be either EXCLUDE or INCLUDE. If set to EXCLUDE then any log that has the specific key, value pair will be filtered. Conversely, if set to INCLUDE then any log not matching the key, value pair exactly will be filtered.

filter(logs)[source]

Filter logs based on key, value item matching.

If a log does not have the key to test against and mode is set to INCLUDE it will be filtered. Conversely, if mode is set to EXCLUDE it will not be filtered.

EXCLUDE = 'exclude'
INCLUDE = 'include'