Hello,
I have the following log line :
"1","O","I","191118 190923","E","0","1455","SFTP","PNVIO111","IT9","/data/files/TRANS","FOPIT901-9281025"
And the following dissect filter :
dissect {
mapping => {
"message" => '"%{type}","%{direction}","%{mode}","%{date}","%{status}","%{code}","%{size}","%{protocol}","%{src}","%{dst}","%{path}","%{file_component}"'
}
My final goal is to split the last field "file_component" into two new fields ("shortidf" and "trans_id"), based on the "-" splitting char.
So I wrote thess mutate filters (based on the doc example here Mutate filter plugin | Logstash Reference [8.11] | Elastic) :
mutate {
copy => { "file_component" => "idf" }
}
mutate {
split => ["idf", "-"]
add_field => { "shortidf" => "%{idf[0]}" }
}
The "copy" is OK (I obtain a field called "idf" in my json output)
the "split" is OK (if I comment the add_field part), I obtain :
"file_component" => "FOPIT901-9281025",
"idf" => [
[0] "FOPIT901",
[1] "9281025"
],
But the add_field => { "shortidf" => "%{idf[0]}" } part gives me an error on logstash output if I activate it in the mutate filter :
org.logstash.FieldReference$IllegalSyntaxException: Invalid FieldReference:
idf[0]
Any idea on what I'm doing wrong ?