Reading Logstash configurations¶
There are multiple ways to use the module to actually read a Logstash configuration: decode the configuration file directly, and evaluate the configuration file in order to decode specific elements of the configuration.
Only decode a Logstash configuration¶
In order to decode a Logstash configuration, you can use parse_lscl()
:
from lscl.parser import parse_lscl
with open("/path/to/logstash.yaml") as fp:
parsed_result = parse_lscl(fp.read())
The result will be expressed using a list of LsclBlock
,
LsclData
and LsclConditions
you can explore
recursively.
Decode Logstash filters¶
In order to decode raw Logstash filters, you can use
parse_logstash_filters()
:
from lscl.filters import parse_logstash_filters
with open("/path/to/logstash.yaml") as fp:
parsed_result = parse_logstash_filters(fp.read())
The result will be expressed using a list of LogstashFilter
and LogstashFilterBranching
you can explore recursively.