user6120465
user6120465

Reputation:

Fluentd modify json output

I need to modify output to from this

"payload": {
  "a": "value",
  "b": "value",
  .....
}

to

"a": "value",
"b": "value",
.....

I was looking at record_transformer but it looks like this is only to for example add new field or modify value of existing json property. Is it possible to extract data like i want to?

Upvotes: 0

Views: 396

Answers (1)

vijay22uk
vijay22uk

Reputation: 564

You can try something like this [If key names are fixed]

@type record_transformer
<record>
   a $${record["payload"]["a"]
   remove_keys payload
</record>

Or this plugin for dynamic keys https://github.com/kazegusuri/fluent-plugin-flatten-hash

Upvotes: 0

Related Questions