Currently I have a working logstash configuration which stores JSON based input data from my IoT data from TTN via output into my Elasticsearch node. Now I would extract some data (e.g. temperature, pressure) and send only the field measurements via http output to the stadtpuls.com API. Currently I use the following filter statement among many others:
### BEGIN stadtpuls.com encoder
if ( [dev_id] == "akiot-htcc-ab01-umweltsensor01") {
mutate {
add_field => {"measurements" => ["%{temperature}","%{pressure}"]}
}
}
### END stadtpuls.com encoder
But how can I prevent that the http output sends the entire JSON based event document to the API?
You could use a prune filter with a whitelist_names options. If you have multiple outputs you might need pipeline-to-pipeline communications with a forked-path pattern.
Thanks for the advice with the forked-pattern. Now it is working, I defined one input and two output pipelines. How could I suppress the app_id tag from output processing, if I use that tag currently for suppressing unneeded output?
You unconditionally remove the [app_id] field in the second mutate, so it will not exist when the event reaches the output section.
If you want to use the app_id in the output section but do not want it sent to the output then use [@metadata][app_id]. Then you can test it in the conditional but it will not be sent on with the event.
I hope that helps. It is not entirely clear what you are asking.
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.