简体   繁体   English

修改流利的json输出

[英]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 谢谢

Based on the answer by repeatedly( https://github.com/repeatedly ). 根据答案反复( https://github.com/repeatedly )。

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

  <record>
    geoip ${{"remote" => "${remote}", "city" => "${city}"}}
  </record>
</filter>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM