A fluent plugin to add script-run result to existing json data
Install it yourself as:
$ fluent-gem install fluent-plugin-script_append
<match access.foo>
type script_append
# currently only ruby supported
language ruby
run_script record['one'].to_i + record['two'].to_i
key three
</match>
Input:
{
"one" : 1,
"two" : 2
}
Then get emitted:
{
"one" : 1,
"two" : 2,
"three" : 3
}
key
, A key for added record to use in json. Requiredlanguage
, A language of script, default to ruby, available:ruby, sh(ell)
- In
language ruby
, the record to add is the value of specified expression - In
language shell
, the record to add is the stdout of specified shell script
- In
run_script
, A script for generating data. Requiredrecord_var_name
, A variable name for original json data inruby
script. Default torecord
new_tag
, A tag name to use in new emissionsprefix
, A tag prefix to add original tag in new emissions.new_tag
orprefix
is required
- Fork it ( https://github.com/[my-github-username]/fluent-plugin-script_append/fork )
- 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 a new Pull Request