Re: handling nested json with record transformer

1,211 views
Skip to first unread message
Message has been deleted

Mr. Fiber

unread,
May 20, 2016, 6:34:41 PM5/20/16
to Fluentd Google Group

On Sat, May 21, 2016 at 6:50 AM, Arash Vatanpoor <ara...@gmail.com> wrote:


I have a payload like this :

{
"event": {
"time": "xxxxxxx",
"type": "forcast",
"extra": {
"info": "lorem",
"more_info": "dafadfadf"
}
}
}



and I have a corresponding filter directive in my fluentd conf :

<filter *>

  type record_transformer

  enable_ruby

  renew_record

  <record>

        time ${event['time']}

        type ${event['type']}

        extra ${event['extra"]}

  </record>

  keep_keys time,type,extra

</filter>


this produces a json like this :

 

     { "time" :  "xxxxxxx", "type": "forcast", "extra":"{\"info\"=>\"lorem\", \"more_info\"=>\"dafadfadf\" }"}


with the nested json as a hash. Even if I add the to_json as extra ${event['extra"].to_json} then I get the nested json but with escape characters.

How can I resolve this basically the desired outcome is this :


 {
"time": "xxxxxxx",
"type": "forcast",
"extra": {
"info": "lorem",
"more_info": "dafadfadf"
}
}

fluentd version :: fluentd-0.12.22

any help would be appreciated.

--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages