I am trying out using a python script as input (exec) to a logstash config file. The python script spits out a dictionary like the one depicted below once every 1 second:
What I want is to transform each of these into a field (with the same name as the key in the dictionary) , and insert it into elasticsearch as a single document.
How can I achieve this ? I've had problems trying to handle the dictionary, as it is inserted alltogether into a field named "message".
Thank you very much for your immediate response, it was very helpful.
I have one additional problem though which is related. After applying the json filter, I want to do the same for the nested document "_source" which I renamed as "re" (short for response), in order to flatten the document. I get the following error:
The json filter will parse a string that is JSON, including nested objects. When you parse "message", "_source" is no longer a string, it is an object, so you cannot pass it to a json filter.
But you can refer to the nested fields. For example...
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.