Converting a hash of key and values to a array of objects

I have a json like
{
"230":{"startDatetime":"2017-07-21T07:00:00","endDatetime":"2017-08-07T06:59:59"},
"232":{"startDatetime":"2017-07-21T07:00:00","endDatetime":"2017-08-07T06:59:59"}
}
and i need to convert to
[
{"location":"230","startDatetime":"2017-07-21T07:00:00","endDatetime":"2017-08-07T06:59:59"},{"location":"232","startDatetime":"2017-07-21T07:00:00","endDatetime":"2017-08-07T06:59:59"}
]

Can we do this in logstash?

Yes, but as I suspect the 230 and 232 are dynamic and not something you can hardcode into your configuration you need to use a ruby filter.

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