Hi everyone,
I am somewhat new to Logstash. I am trying to perform a somewhat special multiline parse, and I have run out of ideas. The thing is, I want to parse some log lines, which must use values found on previous AND posterior lines. The log looks like this:
...
2020-03-15 22:43:55,680 [Component] DEBUG another.different.package - $Info: Useless info
2020-03-15 22:43:55,680 [Component] DEBUG some.package -
Table_1: Table_1_Field_1_name, Table_1_Field_2_name, Table_1_Field_3_name, Table_1_Field_4_name
Table_1: Table_1_Field_1_value_1, Table_1_Field_2_value_1, Table_1_Field_3_value_1, Table_1_Field_4_value_1
Table_2: Table_2_Field_1_name, Table_2_Field_2_name, Table_2_Field_3_name, Table_2_Field_4_name
Table_2: Table_2_Field_1_value_1, Table_2_Field_2_value_1, Table_2_Field_3_value_1, Table_2_Field_4_value_1
Table_2: Table_2_Field_1_value_2, Table_2_Field_2_value_2, Table_2_Field_3_value_2, Table_2_Field_4_value_2
Table_2: Table_2_Field_1_value_3, Table_2_Field_2_value_3, Table_2_Field_3_value_3, Table_2_Field_4_value_3
2020-03-15 22:43:55,681 [Component] DEBUG other.package - Useless info
2020-03-15 22:43:55,688 [Component] INFO some.package - CONSUME API returned(E) errorString(Why was the transaction not successful)
...
If the transaction was successful, the last line of the previous example would look like this:
2020-03-15 22:43:55,688 [Component] INFO some.package - CONSUME API returned(S) errorString()
Each table transaction must be a new event, and they must use as timestamp the one found before the table transactions began. They must also report if the transaction was successful or not (and if not, why not), information which is found until all the tables transactions are over, after 1 log line.
So, for the previous example, the events created would look like this:
{
@timestamp:2020-03-15 22:43:55,680,
table:Table_1,
Table_1_Field_1_name: Table_1_Field_1_value_1,
Table_1_Field_2_name: Table_1_Field_2_value_1,
Table_1_Field_3_name: Table_1_Field_3_value_1,
Table_1_Field_4_name: Table_1_Field_4_value_1,
success:0,
termination_message:Why was the transaction not successful
}
{
@timestamp:2020-03-15 22:43:55,680,
table:Table_2,
Table_2_Field_1_name: Table_2_Field_1_value_1,
Table_2_Field_2_name: Table_2_Field_2_value_1,
Table_2_Field_3_name: Table_2_Field_3_value_1,
Table_2_Field_4_name: Table_2_Field_4_value_1,
success:0,
termination_message:Why was the transaction not successful
}
{
@timestamp:2020-03-15 22:43:55,680,
table:Table_2,
Table_2_Field_1_name: Table_2_Field_1_value_2,
Table_2_Field_2_name: Table_2_Field_2_value_2,
Table_2_Field_3_name: Table_2_Field_3_value_2,
Table_2_Field_4_name: Table_2_Field_4_value_2,
success:0,
termination_message:Why was the transaction not successful
}
{
@timestamp:2020-03-15 22:43:55,680,
table:Table_2,
Table_2_Field_1_name: Table_2_Field_1_value_3,
Table_2_Field_2_name: Table_2_Field_2_value_3,
Table_2_Field_3_name: Table_2_Field_3_value_3,
Table_2_Field_4_name: Table_2_Field_4_value_3,
success:0,
termination_message:Why was the transaction not successful
}
I have tried using the aggregate filter, creating a new aggregation when a pattern matches the first line of the example and ending it when the last one is matched afterwards. This way I can hold the timestamp and I can also know if the transaction was successful or not, but I don't know how to hold all the table transactions in the meantime, and create several events out of them when the end_of_task is set to true. Also, I do not think this is the best way of doing this, as there is no way to have a reliable task_id (I'm using the same task_id for everything).
I know also about the multiline filter, but I don't know how to use information of the ending line, or how to split the appended lines into multiple events.
I only really care about the table transactions.
Any information, ideas, or plug-in suggestions are more than welcome.