I have events going into logstash. Each event has a number of fields two of which I would like to translate
The fields are customer_id and integrator_id.
I would like to add fields customer_name and integrator_name, the "id-to-name" translations coming from csv files.
I can translate one field but how would two be translated.
Thankyou for your reply.
In my case, client_id is numeric and client_name text. Also client_name does not exist and I need it for later.
I also have the integrator_id field which I would like to translate at the same time as the client_id but am not sure how to specify two different fields for translation in the same block of code.
Do you mean LS fails to translate one of the fields in two separate translate blocks? If it fails when you try to put two fields into the field => setting, the reason is above.
I agree with tsangdl. Sounds like all your data is in a single event so the below should work. If the events were not of same format, or you are processing different pieces, you could use IF statements. This should work:
filter {
translate {
dictionary_path => "/etc/logstash/clients.csv"
field => "client_id"
destination => "client_name"
}
translate {
dictionary_path => "/etc/logstash/integrators.csv"
field => "integrator_id"
destination => "integrator_name"
}
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.