Need help flatten json object in logstash filter


my data structure is as follows:
{ "name": "my-validation", "timestamp": "<sometimestamp>", "details": { "2017-01-21": "My Validation result 1: OK", "2017-02-01": "My Validation result 2: OK", "2017-01-22": "My Validation result 3: OK", "2017-01-30": "My Validation result 4: OK" } }

Every day the validation details key changes as it is a date.
I need to visualize the details in a data table, but I can't bind the every-day changing keys to a field within the data table.

Now my idea was to split/mutate the events when reading it by logstash, so that the data structure would be:
{ "name": "my-validation", "timestamp": "<sometimestamp>", "details0": { "2017-01-21": "My Validation result 1: OK" }, "details1": { "2017-02-01": "My Validation result 2: OK" }, "details2": { "2017-01-22": "My Validation result 3: OK" }, "details3": { "2017-01-30": "My Validation result 4: OK" } }
so I could use the static fields details0, details1, etc. to create the data table.

Could anybody plz help to create the logstash-filter?
Or is there any other possible solution?

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.