Welcome to the Linux Foundation Forum!

Lab4 - Filter plugins

In lab4 , we can use record_transformer to transform the values in the kv json input.
Is it also possible to transform the key of the json input , i.e adding a prefix to the key.

For example
input : {"lfs242":"hello","status":"filtered"}

transform to : {"lfs242":"hello","new.status":"filtered"}

Here i'm trying to change the key by adding a prefix to one of the json key (status => new.status)


  • ChristianLacsina964
    edited March 2021

    Hey Nevosial,

    It is possible. On a high level, you will need to:

    • Take the value of status in the incoming record and insert it into a key named new.status
    • Remove the original status key from the record with remove_key

    If you look later in the same lab, you will explore how to take values from existing keys in the record and associate them with brand new keys.

    I will have more specific answers in a later post. Hope this helps for now!

  • nevosial
    nevosial Posts: 7

    Hi Christian,
    Thank you for the quick response !
    i did find out more examples in the lab 4 with record_transformer; however i found that i can use the json parser plugin inject_key_prefix (https://docs.fluentd.org/filter/parser#inject_key_prefix) to do this.

  • nevosial
    nevosial Posts: 7

    i think we can close this thread.

This discussion has been closed.


Upcoming Training