mustash.es
– ElasticSearch ingest pipeline conversion utilities¶
- pydantic model mustash.es.ESProcessor¶
-
ElasticSearch processor.
This class is used for parsing and rendering ElasticSearch ingest pipelines, in order to ensure that we check all options, forbid additional options, and so on.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESAppendProcessor¶
Bases:
ESProcessor
ElasticSearch append processor.
See Append processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESBytesProcessor¶
Bases:
ESProcessor
ElasticSearch bytes processor.
See Bytes processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESCommunityIDProcessor¶
Bases:
ESProcessor
ElasticSearch Community ID processor.
See Community ID processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field seed: Annotated[int, Ge(0), Lt(65536)] = 0¶
- Constraints:
ge = 0
lt = 65536
- pydantic model mustash.es.ESConvertProcessor¶
Bases:
ESProcessor
ElasticSearch convert processor.
See Convert processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field type: Literal['integer', 'long', 'float', 'double', 'string', 'boolean', 'ip', 'auto'] [Required]¶
- pydantic model mustash.es.ESCSVProcessor¶
Bases:
ESProcessor
ElasticSearch CSV processor.
See CSV processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field quote: Annotated[str, StringConstraints(min_length=1, max_length=1)] = '"'¶
- Constraints:
min_length = 1
max_length = 1
- field separator: Annotated[str, StringConstraints(min_length=1, max_length=1)] = ','¶
- Constraints:
min_length = 1
max_length = 1
- pydantic model mustash.es.ESDateProcessor¶
Bases:
ESProcessor
ElasticSearch date processor.
See Date processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESDateIndexNameProcessor¶
Bases:
ESProcessor
ElasticSearch date index name processor.
See Date index name processor for more information.
- Config:
extra: str = forbid
- Fields:
- field date_rounding: Literal['y', 'M', 'w', 'd', 'h', 'm', 's'] [Required]¶
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESDissectProcessor¶
Bases:
ESProcessor
ElasticSearch dissect processor.
See Dissect processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field pattern: DissectPattern [Required]¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESDotExpander¶
Bases:
ESProcessor
ElasticSearch dot expander processor.
See Dot expander processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESDropProcessor¶
Bases:
ESProcessor
ElasticSearch drop processor.
See Drop processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESFailProcessor¶
Bases:
ESProcessor
ElasticSearch fail processor.
See Fail processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESFingerprintProcessor¶
Bases:
ESProcessor
ElasticSearch fingerprint processor.
See Fingerprint processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field method: Literal['MD5', 'SHA-1', 'SHA-256', 'SHA-512', 'MurmurHash3'] = 'SHA-1'¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESGeoIPProcessor¶
Bases:
ESProcessor
ElasticSearch GeoIP processor.
See GeoIP processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field properties: list[str] = ['continent_name', 'country_iso_code', 'country_name', 'region_iso_code', 'region_name', 'city_name', 'location']¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESGrokProcessor¶
Bases:
ESProcessor
ElasticSearch grok processor.
See Grok processor for more information.
- Config:
extra: str = forbid
- Fields:
- field ecs_compatibility: Literal['disabled', 'v1'] = 'disabled'¶
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESGsubProcessor¶
Bases:
ESProcessor
ElasticSearch gsub processor.
See Gsub processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESHTMLStripProcessor¶
Bases:
ESProcessor
ElasticSearch HTML strip processor.
See HTML strip processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESJoinProcessor¶
Bases:
ESProcessor
ElasticSearch join processor.
See Join processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESJSONProcessor¶
Bases:
ESProcessor
ElasticSearch JSON processor.
See JSON processor for more information.
- Config:
extra: str = forbid
- Fields:
- field add_to_root_conflict_strategy: Literal['replace', 'merge'] = 'replace'¶
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESKVProcessor¶
Bases:
ESProcessor
ElasticSearch KV processor.
See KV processor for more information.
- Config:
extra: str = forbid
- Fields:
- field field_split: re.Pattern [Required]¶
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field value_split: re.Pattern [Required]¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESLowercaseProcessor¶
Bases:
ESProcessor
ElasticSearch lowercase processor.
See Lowercase processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESNetworkDirectionProcessor¶
Bases:
ESProcessor
ElasticSearch network direction processor.
See Network direction processor for more information.
- Config:
extra: str = forbid
- Fields:
- Validators:
_validate
»all fields
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESRedactProcessor¶
Bases:
ESProcessor
ElasticSearch redact processor.
See Redact processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESRegisteredDomainProcessor¶
Bases:
ESProcessor
ElasticSearch registered domain processor.
See Registered domain processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESRemoveProcessor¶
Bases:
ESProcessor
ElasticSearch remove processor.
See Remove processor for more information.
- Config:
extra: str = forbid
- Fields:
- Validators:
_validate
»all fields
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESRenameProcessor¶
Bases:
ESProcessor
ElasticSearch rename processor.
See Rename processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESRerouteProcessor¶
Bases:
ESProcessor
ElasticSearch reroute processor.
See Reroute processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESScriptProcessor¶
Bases:
ESProcessor
ElasticSearch script processor.
See Script processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field lang: Literal['painless'] = 'painless'¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESSetProcessor¶
Bases:
ESProcessor
ElasticSearch set processor.
See Set processor for more information.
- Config:
extra: str = forbid
- Fields:
- Validators:
_validate
»all fields
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESSetSecurityUserProcessor¶
Bases:
ESProcessor
ElasticSearch set security user processor.
See Set security user processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field properties: list[str] = ['username', 'roles', 'email', 'full_name', 'metadata', 'api_key', 'realm', 'authentication_type']¶
- build(cls: type[Processor], /, **kwargs) Processor ¶
Obtain a Mustash processor out of the current processor.
This also manages common parameters for all processors.
- convert() Processor ¶
Convert the ElasticSearch processor into a Mustash processor.
- Returns:
Converted processor.
- Raises:
NotImplementedError – No processor is currently available for this configuration of the processor.
- Return type:
- pydantic model mustash.es.ESSortProcessor¶
Bases:
ESProcessor
ElasticSearch sort processor.
See Sort processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field order: Literal['asc', 'desc'] [Required]¶
- pydantic model mustash.es.ESSplitProcessor¶
Bases:
ESProcessor
ElasticSearch split processor.
See Split processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field separator: re.Pattern [Required]¶
- pydantic model mustash.es.ESTrimProcessor¶
Bases:
ESProcessor
ElasticSearch trim processor.
See Trim processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESUppercaseProcessor¶
Bases:
ESProcessor
ElasticSearch uppercase processor.
See Uppercase processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESURIPartsProcessor¶
Bases:
ESProcessor
ElasticSearch URI parts processor.
See URI parts processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESURLDecodeProcessor¶
Bases:
ESProcessor
ElasticSearch URL decode processor.
See URL decode processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- pydantic model mustash.es.ESUserAgentProcessor¶
Bases:
ESProcessor
ElasticSearch user agent processor.
See User agent processor for more information.
- Config:
extra: str = forbid
- Fields:
- field if_: Annotated[str | None, Field(alias='if')] = None (alias 'if')¶
- field properties: list[str] = ['name', 'major', 'minor', 'patch', 'build', 'os', 'os_name', 'os_major', 'os_minor', 'device']¶
- class mustash.es.ESIngestPipelineParser(*, name: str | None = None, processors: dict[str, type[ESProcessor]] | None = None)¶
Bases:
object
ElasticSearch ingest pipeline converter for mustash.
- Parameters:
name (str | None) – Optional name with which the parser wants to be represented.
processors (dict[str, type[ESProcessor]] | None) – Processors supported by the pipeline.
- copy(*, with_processors: dict[str, ESProcessor] | None = None, without_processors: Iterable[str] | None = None) ESIngestPipelineParser ¶
Copy the parser.
- Parameters:
with_processors (dict[str, ESProcessor] | None) – Processors to add in the new parser. If the key exists in the current parser, the processor will be replaced automatically in the new parser.
without_processors (Iterable[str] | None) – Processors to remove from the current parser.
- Returns:
New parser with the modified processors.
- Return type:
- mustash.es.DEFAULT_INGEST_PIPELINE_PARSER = DEFAULT_INGEST_PIPELINE_PARSER¶
Default ElasticSearch ingest pipeline parser instance.
This instance defines all of the default processors available in all contexts, including on ElasticSearch and in Logstash’s
elastic_integration
filter.
- mustash.es.parse_ingest_pipeline(raw: Any, /, *, parser: ESIngestPipelineParser = DEFAULT_INGEST_PIPELINE_PARSER) Pipeline ¶
Parse an ElasticSearch ingest pipeline’s processors.
- Parameters:
raw (Any) – Raw ingest pipeline to parse the processors from, either provided as a dictionary or a raw JSON-encoded string.
parser (ESIngestPipelineParser) – Parser to use to read the pipeline’s processors.
- Returns:
Parsed ElasticSearch processors.
- Return type:
- mustash.es.validate_ingest_pipeline_processors(raw: Any, /, *, parser: ESIngestPipelineParser = DEFAULT_INGEST_PIPELINE_PARSER) list[dict] ¶
Validate an ElasticSearch ingest pipeline’s processors.
- Parameters:
raw (Any) – Raw ingest pipeline to validate the processors from, either provided as a dictionary or a raw JSON-encoded string.
parser (ESIngestPipelineParser) – Parser to use to validate the pipeline’s processors.
- Returns:
Validated ElasticSearch processors.
- Return type:
- mustash.es.validate_ingest_pipeline_failure_processors(raw: Any, /, *, parser: ESIngestPipelineParser = DEFAULT_INGEST_PIPELINE_PARSER) list[dict] ¶
Validate an ElasticSearch ingest pipeline’s failure processors.
- Parameters:
raw (Any) – Raw ingest pipeline to validate the failure processors from, either provided as a dictionary or a raw JSON-encoded string.
parser (ESIngestPipelineParser) – Parser to use to validate the pipeline’s failure processors.
- Returns:
Validated ElasticSearch failure processors.
- Return type:
- mustash.es.render_as_ingest_pipeline(pipeline: Pipeline, /) list ¶
Render a list of processors as an ElasticSearch ingest pipeline.
- Parameters:
pipeline (Pipeline) – Pipeline to render as an ElasticSearch ingest pipeline.
- Returns:
Rendered pipeline.
- Raises:
ValueError – The pipeline is not renderable as an ElasticSearch ingest pipeline.
- Return type: