I want to add fields to a record only if the corresponding incoming record contains the field with a non-empty value.
For example, in rsyslog I can do something like this:
if strlen($!_BOOT_ID) > 0 then {
set $.systemd!t!BOOT_ID = $!_BOOT_ID;
}
To convert this:
{
...
"_BOOT_ID": "foo",
}
to this:
"systemd": {
"t": {
"BOOT_ID": "foo",
I tried doing this in fluentd:
<filter something**>
type record_transformer
enable_ruby
<record>
dummy ${((record['systemd'] ||= {})['t'] ||= {})['BOOT_ID'] =
record['_BOOT_ID'] if record['_BOOT_ID']}
</record>
remove_keys dummy
</filter>
But this doesn't work - it seems that the ${ ... } is evaulated
in some context in which the record is a copy?
--
You received this message because you are subscribed to the Google Groups "Fluentd Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fluentd+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.