Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify fluentd json output

Tags:

json

fluentd

How can we easily transform with fluentd( and plugins ) something like this

{
    "remote": "87.85.14.126",
    "city": "saint-hubert"
}

To this:

{
   "geoip": {
       "remote": "87.85.14.126",
       "city": "saint-hubert"
   }
}

Thank you

like image 431
Florent Valdelievre Avatar asked Dec 17 '14 10:12

Florent Valdelievre


1 Answers

Based on the answer by repeatedly(https://github.com/repeatedly).

<filter test.**>
  @type record_transformer
  enable_ruby true
  auto_typecast true

  <record>
    geoip ${{"remote" => "${remote}", "city" => "${city}"}}
  </record>
</filter>
like image 136
Haoyuan Ge Avatar answered Oct 22 '22 06:10

Haoyuan Ge