How to change record value in Fluentd (td-agent)
If we need to change a value in a record in Fluentd (td-agent), we can use "record_transformer" plugin. The plugin is already installed when you installed td-agent package, we don't need to install anything.How to manipulate a column value
In order to modify a column value in Fluentd, we can use Ruby language's expression. We need to use "record_transformer" plugin then need to add "enable_ruby true", so that we can use Ruby language. This is very powerful feature.Here is an example of record manipulation.
<filter **> @type record_transformer enable_ruby true <record> uuid ${record['foo']}_${record['bar']} maybe_empty ${record["pikachu"] ? record["pikachu"] : "empty"} </record> </filter>
In this case, "foo" column value and "bar" column value are concatenated, then generate "uuid" value.
Also, if "pikachu" column value is empty, "maybe_empty" column value is "empty". If "pikachu" column value is not empty, "maybe_empty" column value is "pikachu"'s column value. This is very powerful and flexible!