lscl.filters – Logstash filter related utilities

lscl.filters.LogstashFilters = LogstashFilters

Type representing a list of Logstash filters and branching.

pydantic model lscl.filters.LogstashFilter

Bases: BaseModel

Definition of a Logstash filter.

Fields:
field config: dict[str, LsclData] = {}

Configuration for the filter.

field name: str [Required]

Name of the filter.

pydantic model lscl.filters.LogstashFilterBranching

Bases: BaseModel

Condition under which one or more filters can be executed.

Fields:
field conditions: Annotated[list[tuple[LsclCondition, LogstashFilters]], Len(min_length=1)] [Required]

Conditions and associated filters and additional branching.

field default: LogstashFilters | None = None

Default branch to take, if other branches aren’t explored.

lscl.filters.parse_logstash_filters(raw: str | LsclContent | LsclBlock, /, *, at_root: bool | None = None) LogstashFilters

Decode filters from a Logstash configuration file.

Parameters:
  • raw (str | LsclContent | LsclBlock) – Raw configuration, to decode filters from.

  • at_root (bool | None) – Whether the filters should be look for at root (True), in the “filter” block (False), or in the second case with a fallback to the first if unsure (None).

Returns:

Obtained Logstash filters.

Return type:

LogstashFilters

lscl.filters.render_logstash_filters(filters: LogstashFilters, /) str

Render Logstash filters.

Parameters:

filters (LogstashFilters) – Logstash filters or branching.

Returns:

Filters encoded using LSCL.

Return type:

str