【发布时间】:2018-01-11 05:37:11
【问题描述】:
我正在使用 fluentd,我需要在当前记录中添加一个新标签。此标记的值存在于同一记录中的另一个值中。
例子:
Sample record:
{"xff":null,"host":"0.0.0.1","method":"GET","referer":null,"url_path":"/abcd/attr1=value1&attr2=value2&noOfUsers=123456789&e="}
Expected output is:
{"xff":null,"host":"0.0.0.1","method":"GET","referer":null,"url_path":"/abcd/attr1=value1&attr2=value2&test=123456789&e=","noOfUsers":"123456789"}
如您所见,我将从“url_path”值中获取新标签“noOfUsers”的值。
我搜索了一些信息并获得了详细信息,我应该为此使用 ruby 脚本。
我可以知道什么是正确的解决方案以及我应该使用什么 ruby 脚本来实现这一点?
<filter *.test>
type record_transformer
<record>
?????
</record>
enable_ruby true
</filter>
【问题讨论】: