mustash.processors
– Built-in processors¶
- pydantic model mustash.processors.AppendProcessor¶
Bases:
Processor
Processor for adding values to a list / array.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- pydantic model mustash.processors.BooleanProcessor¶
Bases:
FieldProcessor
Processor for converting a value into a boolean.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.BytesProcessor¶
Bases:
FieldProcessor[str]
Processor for converting human-readable byte values into a number.
This processor parses the field as a string representing a size with a number and unit, e.g.
123 MB
, and converts it into their numeric value in bytes.For more information, see Bytes processor (ElasticSearch) and bytes mutation (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.CommunityIDProcessor¶
Bases:
Processor
Processor for computing the community ID for network flow data.
Community ID is defined in the Community ID Flow Hashing Specification.
For more information, see Community ID processor (ElasticSearch).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- field destination_ip_field: FieldPath = FieldPath('destination.ip')¶
Path to the field containing the destination IP address.
- field destination_port_field: FieldPath = FieldPath('destination.port')¶
Path to the field containing the destination port.
- field iana_number_field: FieldPath = FieldPath('network.iana_number')¶
Path to the field containing the IANA number of the transport protocol.
Such numbers are defined in the Protocol Numbers registry.
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- field seed: Annotated[int, Ge(0), Lt(65536)] = 0¶
Seed for the community ID hash.
This seed can prevent hash collisions between network domains, such as staging and production network that use the same addressing scheme.
- Constraints:
ge = 0
lt = 65536
- field source_ip_field: FieldPath = FieldPath('source.ip')¶
Path to the field containing the source IP address.
- field source_port_field: FieldPath = FieldPath('source.port')¶
Path to the field containing the source port.
- field target_field: FieldPath = FieldPath('network.community_id')¶
Output field for the community identifier.
- field transport_field: FieldPath = FieldPath('network.transport')¶
Path to the field containing the name of the transport protocol.
This is only used if the field referenced by
iana_number_field
is not present in the document.
- pydantic model mustash.processors.CopyProcessor¶
Bases:
Processor
Processor for appending values to an existing array.
For more information, see Set processor (ElasticSearch) and copy mutation (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- pydantic model mustash.processors.CSVProcessor¶
Bases:
Processor
Processor for parsing a singleCSV line.
For more information, see CSV processor (ElasticSearch) and csv filter (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- field quote: Annotated[str, StringConstraints(min_length=1, max_length=1)] = '"'¶
Single-character quote used in CSV.
- Constraints:
min_length = 1
max_length = 1
- field separator: Annotated[str, StringConstraints(min_length=1, max_length=1)] = ','¶
Single-character separator used in CSV.
- Constraints:
min_length = 1
max_length = 1
- pydantic model mustash.processors.DateProcessor¶
Bases:
FieldProcessor
Processor for parsing dates and adding a timestamp.
For more information, see Date processor (ElasticSearch) and date filter (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- field output_handler: DateTimeFormatter [Required]¶
Date and time format handler.
- field parse_handler: DateTimeFormatter [Required]¶
Date and time parsing handler.
- field timezone: tzinfo [Required]¶
Timezone to use when parsing the date.
- async apply(document: Document, /) None ¶
Apply the processor to the document, in-place.
- Parameters:
document (Document) – Document to which to apply the processor.
- Return type:
None
- async process(value: Element, /) Element ¶
Process the field into the expected type.
- Parameters:
value (Element) – Value to process.
- Returns:
Processed value.
- Return type:
Element
- pydantic model mustash.processors.DropProcessor¶
Bases:
Processor
Processor for dropping the current document.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- pydantic model mustash.processors.FloatingPointProcessor¶
Bases:
FieldProcessor
Processor for converting a value into a floating-point number.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- field precision: Literal['half', 'double'] [Required]¶
Precision expected for the target field.
- pydantic model mustash.processors.IntegerProcessor¶
Bases:
FieldProcessor
Processor for converting a value into an integer.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.IPAddressProcessor¶
Bases:
FieldProcessor
Processor for converting a value into an IPv4 or IPv6 address.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- async apply(document: Document, /) None ¶
Apply the processor to the document, in-place.
- Parameters:
document (Document) – Document to which to apply the processor.
- Return type:
None
- async process(value: Element, /) IPv4Address | IPv6Address ¶
Process the field into the expected type.
- Parameters:
value (Element) – Value to process.
- Returns:
Processed value.
- Return type:
- pydantic model mustash.processors.JsonProcessor¶
Bases:
Processor
Processor for parsing raw JSON from a field into another, or root.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field add_to_root: bool = False¶
Whether to add the parsed data to root rather than in a target field.
This must not be defined to
True
iftarget_field
is defined.
- pydantic model mustash.processors.KeepProcessor¶
Bases:
Processor
Processor for only keeping some fields.
For more information, see Remove processor (ElasticSearch) and prune filter (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- pydantic model mustash.processors.LowercaseProcessor¶
Bases:
FieldProcessor[str]
Processor for converting a string to its lowercase equivalent.
For more information, see Lowercase processor (ElasticSearch) and lowercase mutation (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.RemoveProcessor¶
Bases:
Processor
Processor for removing one or more fields.
For more information, see Remove processor (ElasticSearch) and prune filter (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- pydantic model mustash.processors.SetProcessor¶
Bases:
Processor
Processor for setting a field to a value.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- field value: Element [Required]¶
Value to add to the document.
- pydantic model mustash.processors.SortProcessor¶
Bases:
FieldProcessor[list]
Processor for sorting an array.
For more information, see Sort processor (ElasticSearch).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- field order: Literal['asc', 'desc'] = 'asc'¶
Order in which the array should be sorted.
- pydantic model mustash.processors.RegexpSplitProcessor¶
Bases:
FieldProcessor[str]
Processor for splitting a string into an array.
For more information, see Split processor (ElasticSearch) and split filter (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- field separator: re.Pattern [Required]¶
Separator pattern.
- pydantic model mustash.processors.StringProcessor¶
Bases:
FieldProcessor
Processor for converting a value into a string.
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.TrimProcessor¶
Bases:
FieldProcessor[Union[str, list[str]]]
Processor for trimming a string.
For more information, see Trim processor (ElasticSearch) and strip mutation (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.UppercaseProcessor¶
Bases:
FieldProcessor[str]
Processor for converting a string to its uppercase equivalent.
For more information, see Uppercase processor (ElasticSearch) and uppercase mutation (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.URIPartsProcessor¶
Bases:
FieldProcessor[str]
Processor for parsing an URI to extract parts.
For more information, see URI parts processor (ElasticSearch).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.URLDecodeProcessor¶
Bases:
FieldProcessor[str]
Processor for decoding an URL.
For more information, see URL decode processor (ElasticSearch) and urldecode filter (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- pydantic model mustash.processors.UserAgentProcessor¶
Bases:
FieldProcessor[str]
Processor for parsing a user agent.
For more information, see User agent processor (ElasticSearch) and useragent filter (Logstash).
- Config:
extra: str = forbid
arbitrary_types_allowed: bool = True
- Fields:
- Validators:
_validate
»all fields
- field ignore_missing: bool = False¶
Whether not to fail if the field is not present in the document.
- field properties: list[str] = ['name', 'major', 'minor', 'patch', 'build', 'os', 'os_name', 'os_major', 'os_minor', 'device']¶
Properties to add to the target.
- field regex_file: str | None = None¶
Name of the file containing the regular expressions for parsing.