I had json format log and outputto elasticseach. I try to use "if" and "mutate" which copy Message to new field. But the new field can't viewed in elasticsearch and kibana. My Message field like "S", "E", "any string"...
and my code like below.
filter{
if [Message]=="S"{
mutate{copy=>{"Message"=>"action"}}
}
else if [Message]=="E"{
mutate{copy=>{"Message"=>"action"}}
}
}
Another try:
filter{
if [Message]=="S"{
add_field{"Message"=>"Action"}
mutate{copy=>{"Message"=>"action"}}
}
else if [Message]=="E"{
mutate{copy=>{"Message"=>"action"}}
}
}
Keep in mind that the options given to the mutate filter aren't necessarily executed in the order given. If you have different mutate operations that depend on each other you should use different mutate filters. In this particular case the copy operation will run first, followed by the add_field operation.
Thanks, it work by "add_field" before "if" and "copy". But I get another problem. When I use logstash -f , can work to view "S" and "E" in kibana. When I use logstash -t -f and "Configuration OK", it not work.
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.