Hi everybody,
First of all, thanks for your time.
I have a question regarding to Logstash. I would like to join some array elements as of a specific element. The log that I am processing, the first six fields have the same pattern, I mean, it always appears date in the first, second and third field, the server name in the fourth, class name in the fifth and log level in the sixth. The rest fields'll be variable. For that reason it came to my mind the idea to split the field message:
"message" => [
[0] "03/31/2023",
[1] "07:10:00.005837",
[2] "CST",
[3] "elk1",
[4] "(SFTPSource)",
[5] "DEBUG4:",
[6] "SFTPSource.listDirectory()",
[7] "fileNames=[invalid_files_tmp.tar.gz,",
[8] "invalid_files_tmp,",
[9] "responseOIDLOA1_23032023_115452.txt]"
],
I did this with the next code:
mutate {
split => { "message" => " " }
}
ruby {
code => "event.set('number_of_elements', event.get('message').length)"
}
So, I would like to join the fields as of seventh element array up to the last element. Last number element it'd be saved in 'number_of_elements' which I got using ruby module.
How can I join or paste the rest elements to a new variable?
Thanks.