Skip to content

Add documentation and example for nested tags #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion filter_plugins/filter_record_transformer.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ For NEW_VALUE, a special syntax `${}` allows the user to generate a new field dy
- `tag_suffix[N]` refers to the last N parts of the tag. It works like the usual zero-based array accessor.
- `tag` refers to the whole tag.

For accessing nested tags, you need to set the `enable_ruby` directive, and then the sub-tags are available by specifying tags after each other. For example, if you use the kubernetes metadata plugin, you can get the app name like this:


<filter kubernetes.*>
type record_transformer
ruby_enable
<record>
app_name ${record["kubernetes"]["labels"]["app"]}
</record>
</filter>


### enable_ruby (optional)

When set to true, the full Ruby syntax is enabled in the `${...}` expression. The default value is false.
Expand All @@ -97,4 +109,4 @@ A comma-delimited list of keys to delete.
## Learn More

- [Filter Plugin Overview](filter-plugin-overview)
- [grep Filter Plugin](filter_grep)
- [grep Filter Plugin](filter_grep)