I am having one json file and I am trying to parse those json field in logstash. so I decided to create one ruby file from that I have to parse those json fields. is there any way to do this process?
And I have to parse those json file field in dynamic way. which means I have to write only one logstash configuration file and it should be working with all cases. if I add anything in json file, the logstash file will work with that case.
Thanks.
If I am using kv filter, I have to mentioned all the values statically. but I don't want to do this because my input values are taken from the json file . and this file is contain dynamic values. If I change or add anything in json file, I don't want to change that config file too.
If I am using kv filter, I have to mentioned all the values statically.
No, that's not true. Perhaps you're thinking of the csv filter.
but I don't want to do this because my input values are taken from the json file . and this file is contain dynamic values. If I change or add anything in json file, I don't want to change that config file too.
Use a json or json_lines codec or a json filter to parse JSON data.
I am not clear with these method. I have separate json file and I am getting all the values from that file. I have to parse those json files when the 'message' contains some specific string I have to parse only those type of json values.
for example,
json file,
{
"index_name" : "sample_index-%{+YYYY.MM.dd}",
"host" : "localhost",
"fields" : "example-query, testing-process",
"example-query" : {
"keywords" : ["processid","date"],
"f_split" : ", ",
"v_split" : "="
},
"testing-process" : {
"isSearchKey" : "false",
"keywords" : ["processvalue","activitydate"],
"f_split" : ";",
"v_split" : ":"
}
}
from this json example, If my message field contains "fields" : "example-query, testing-process", any of this one fields value it will take the respective values from json file. from that value I have to parse those values.
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.