Fluent::Plugin::Replace
Fluentd plugin to replace the string with specified YAML.
Installation
$ gem install fluent-plugin-replace
Example
<match test>
type replace
rules_yaml $HOME/fluent/test_rules.yml
tag replaced.test
</match>
<match replaced.test>
type stdout
</match>
# test_rules.yml
ip:
127.0.0.1: 'localhost'
/^192\.168.*$/: 'private network'
host:
/.*\.sakigakeweb\.com$/: 'Old Domain'
status:
200: 'OK'
referer:
/http:\/\/kaihar4\.com/: ''
$ echo '{"ip":"127.0.0.1","host":"kaihar4.com","status":200,"referer":"http://kaihar4.com/about.html"}' | fluent-cat test
{"ip":"localhost","host":"kaihar4.com","status","OK","referer":"/about.html"}
$ echo '{"ip":"192.168.1.2","host":"foo.sakigakeweb.com","status":404,"referer":"https://www.google.co.jp/"}' | fluent-cat test
{"ip":"private network","host":"Old Domain","status":404,"referer":"https://www.google.co.jp/"}