Data Types¶
Bro/Zeek Types¶
Boolean¶
- class zlogging.types.BoolType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - booldata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 
Numeric Types¶
- class zlogging.types.CountType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - countdata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 
- class zlogging.types.IntType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - intdata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 
- class zlogging.types.DoubleType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - doubledata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 
Time Types¶
- class zlogging.types.TimeType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - timedata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 
- class zlogging.types.IntervalType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - intervaldata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
- Variables:
 
String¶
- class zlogging.types.StringType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - stringdata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 
Network Types¶
- class zlogging.types.PortType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - portdata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 
- class zlogging.types.AddrType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - addrdata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 - parse(data)[source]¶
- Parse - datafrom string.- Parameters:
- data ( - Union[- str,- bytes,- IPv4Address,- IPv6Address]) – raw data
- Return type:
- Returns:
- The parsed IP address. If - datais unset,- Nonewill be returned.
 
 - tojson(data)[source]¶
- Serialize - dataas JSON log format.- Parameters:
- data ( - Union[- IPv4Address,- IPv6Address,- None]) – raw data
- Returns:
- The JSON serialisable IP address string. 
- Return type:
 
 - toascii(data)[source]¶
- Serialize - dataas ASCII log format.- Parameters:
- data ( - Union[- IPv4Address,- IPv6Address,- None]) – raw data
- Returns:
- The ASCII representation of the IP address. 
- Return type:
 
 
- class zlogging.types.SubnetType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - subnetdata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 - parse(data)[source]¶
- Parse - datafrom string.- Parameters:
- data ( - Union[- str,- bytes,- IPv4Network,- IPv6Network]) – raw data
- Return type:
- Returns:
- The parsed IP network. If - datais unset,- Nonewill be returned.
 
 - tojson(data)[source]¶
- Serialize - dataas JSON log format.- Parameters:
- data ( - Union[- IPv4Network,- IPv6Network,- None]) – raw data
- Returns:
- The JSON serialisable IP network string. 
- Return type:
 
 - toascii(data)[source]¶
- Serialize - dataas ASCII log format.- Parameters:
- data ( - Union[- IPv4Network,- IPv6Network,- None]) – raw data
- Returns:
- The ASCII representation of the IP network. 
- Return type:
 
 
Enumeration¶
- class zlogging.types.EnumType(empty_field=None, unset_field=None, set_separator=None, namespaces=None, bare=False, enum_hook=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - enumdata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- bare ( - bool) – If- True, do not load- zeeknamespace by default.
- enum_hook ( - Optional[- dict[- str,- Enum]]) – Additional enum to be included in the namespace.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 
Container Types¶
- class zlogging.types.SetType(empty_field=None, unset_field=None, set_separator=None, element_type=None, *args, **kwargs)[source]¶
- Bases: - _GenericType,- Generic[- _S]- Bro/Zeek - setdata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- element_type ( - Union[- TypeVar(- _S, bound= _SimpleType),- Type[- TypeVar(- _S, bound= _SimpleType)],- None]) – Data type of container’s elements.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
- Raises:
- ZeekTypeError – If - element_typeis not supplied.
- ZeekValueError – If - element_typeis not a valid Bro/Zeek data type.
 
 - Example - As a generic data type, the class supports the typing proxy as introduced PEP 484: - >>> SetType[StringType] - which is the same at runtime as following: - >>> SetType(element_type=StringType()) - Note - A valid - element_typeshould be a simple data type, i.e. a subclass of- _SimpleType.
- class zlogging.types.VectorType(empty_field=None, unset_field=None, set_separator=None, element_type=None, *args, **kwargs)[source]¶
- Bases: - _GenericType,- Generic[- _S]- Bro/Zeek - vectordata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- element_type ( - Union[- TypeVar(- _S, bound= _SimpleType),- Type[- TypeVar(- _S, bound= _SimpleType)],- None]) – Data type of container’s elements.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
- Raises:
- ZeekTypeError – If - element_typeis not supplied.
- ZeekValueError – If - element_typeis not a valid Bro/Zeek data type.
 
 - Example - As a generic data type, the class supports the typing proxy as introduced PEP 484: - >>> VectorType[StringType] - which is the same at runtime as following: - >>> VectorType(element_type=StringType()) - Note - A valid - element_typeshould be a simple data type, i.e. a subclass of- _SimpleType.
- class zlogging.types.RecordType(empty_field=None, unset_field=None, set_separator=None, *args, **element_mapping)[source]¶
- Bases: - _VariadicType- Bro/Zeek - recorddata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- element_mapping ( - Union[- Type[- _SimpleType],- _SimpleType,- _GenericType]) – Data type of container’s elements.
- *args (Any) – Arbitrary positional arguments. 
- **kwargs (Any) – Arbitrary keyword arguments. 
 
- Raises:
- ZeekTypeError – If - element_mappingis not supplied.
- ZeekValueError – If - element_mappingis not a valid Bro/Zeek data type; or in case of inconsistency from- empty_field,- unset_fieldand- set_separatorof each field.
 
- Return type:
 - Note - A valid - element_mappingshould be a simple or generic data type, i.e. a subclass of- _SimpleTypeor- _GenericType.- See also - See - _aux_expand_typing()for more information about processing the fields.
Any type¶
- class zlogging.types.AnyType(empty_field=None, unset_field=None, set_separator=None, json_encoder=None, *args, **kwargs)[source]¶
- Bases: - _SimpleType- Bro/Zeek - anydata type.- Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- json_encoder ( - Optional[- Type[- JSONEncoder]]) – JSON encoder class for- tojson()method calls.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 - Note - The - AnyTypeis only used for arbitrary typing as required in- JSONParser. It is NOT a valid type of Bro/Zeek logging framework.
Abstract Base Types¶
- class zlogging.types.BaseType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - object- Base Bro/Zeek data type. - Parameters:
- empty_field ( - Union[- str,- bytes,- None]) – Placeholder for empty field.
- unset_field ( - Union[- str,- bytes,- None]) – Placeholder for unset field.
- set_separator ( - Union[- str,- bytes,- None]) – Separator for- set/- vectorfields.
- *args ( - Any) – Arbitrary positional arguments.
- **kwargs ( - Any) – Arbitrary keyword arguments.
 
 - __call__(data)[source]¶
- Parse - datafrom string.- This is a proxy method which calls to - parse()of the type implementation.
 
- class zlogging.types._SimpleType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - BaseType- Simple data type. - In Bro/Zeek script language, such simple type includes - bool,- count,- int,- double,- time,- interval,- string,- addr,- port,- subnetand- enum.- To support arbitrary typing as required in - JSONParser,- any, the arbitrary date type is also included.
- class zlogging.types._GenericType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- 
Generic data type. In Bro/Zeek script language, such generic type includes setandvector, which are also known as container types.
- class zlogging.types._VariadicType(empty_field=None, unset_field=None, set_separator=None, *args, **kwargs)[source]¶
- Bases: - BaseType- Variadic data type. - In Bro/Zeek script language, such variadic type refers to - record, which is also a container type.- 
element_mapping: OrderedDict[str,Union[_SimpleType,_GenericType]]¶
- Data type of container’s elements. 
 
- 
element_mapping: 
