Florent Valdelievre
Florent Valdelievre

Reputation: 1576

Modify fluentd json output

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

Upvotes: 13

Views: 4333

Answers (1)

Haoyuan Ge
Haoyuan Ge

Reputation: 3699

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>

Upvotes: 7

Related Questions