Fluent::Plugin::ConditionalFilter, a plugin for Fluentd ![BuildStatus](https://camo.githubusercontent.com/6c338f53b1733a0a738a22ed43c2c8913372dbf194991038d4b942954e16c65c/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6b656e7461726f2f666c75656e742d706c7567696e2d636f6e646974696f6e616c5f66696c7465722e706e67)
fluent-plugin-conditional_filter provides a simple filter that filters out key/value pairs that don't satisfy a given condition. This is the filter version of ConditionalFilterOutput.
If there's such a configuration as below:
<filter test.**>
type conditional
key_pattern @example\.com$
condition 10
filter numeric_upward
</filter>
When the log below reaches:
'test' => {
'[email protected]' => 5,
'[email protected]' => 15,
'[email protected]' => 12,
}
key/value pairs that don't match either key_pattern
or the condition designated by condition
and filter
are filtered out.
'filtered.test' => {
'[email protected]' => 15,
}
Key pattern to check.
Condition for the filter below.
Set filtering strategy.
fluent-plugin-conditional_filter provides a simple filter that filters out key/value pairs that don't satisfy a given condition.
If there's such a configuration as below:
<match test.**>
type conditional_filter
add_tag_prefix filtered.
key_pattern @example\.com$
condition 10
filter numeric_upward
</match>
When the log below reaches:
'test' => {
'[email protected]' => 5,
'[email protected]' => 15,
'[email protected]' => 12,
}
key/value pairs that don't match either key_pattern
or the condition designated by condition
and filter
are filtered out.
'filtered.test' => {
'[email protected]' => 15,
}
Key pattern to check.
Condition for the filter below.
Set filtering strategy.
You can also use the params above inherited from Fluent::HandleTagNameMixin.
Filter out such key/value pairs whose value aren't greater than or equal to the given value as float value.
Filter out such key/value pairs whose value aren't smaller than or equal to the given value as float value
Filter out such key/value pairs whose value don't match the given value as string.
Add this line to your application's Gemfile:
gem 'fluent-plugin-conditional_filter'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fluent-plugin-conditional_filter
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request