datalogd.plugins.keyval_datafilter module¶
-
class
datalogd.plugins.keyval_datafilter.
KeyValDataFilter
(sinks=[], select=True, keyvals=None, key='type', val=None)[source]¶ Bases:
datalogd.DataFilter
Select or reject data based on key–value pairs.
Received data items will be inspected to see whether they contain the given keys, and that their values match the given values. The key-value pairs are supplied as a list in the form
[[key, value], [key2, value2]...]
. All key-value pairs must be matched. A value of the python special value ofNotImplemented
will match any value. If bothvalue
anddata[key]
are strings, matching will be performed using regular expressions (in which case".*"
will match all strings). If theselect
flag isTrue
, only matching data will be passed on to the connected sinks, if it isFalse
, only non-matching data (or data that does not contain the givenkey
) will be passed on.If only a single key-value pair needs to be matched, they may alternatively be passed as the
key
andval
parameters. This is mainly intended for backwards compatibility.Parameters: - select – Pass only matching data, or only non-matching data.
- keyvals – List of dictionary key-value pairs to match in incoming data.
-
receive
(data)[source]¶ Accept the provided
data
, and select or reject items before passing on to any connected sinks.The selection is based upon the parameters provided to the constructor of this
KeyValDataFilter
.Parameters: data – Data to filter.