Socket
Book a DemoInstallSign in
Socket

fluent-plugin-json-by-name

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluent-plugin-json-by-name

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

fluent-plugin-json-by-name

what does this plugin do

With this plugin you can add json fields as fluent field by the name of the json field

Configuration

For just indexing, provide the fields with value null in json:

<filter **>
  @type json_by_name
  fields_to_index {
    "test1": null,
    "test2": null,
    "test3": null
  }
</filter>

If you also want to rename the field, provide a new name as string instead of null. All this also works for nested fields:

<filter **>
  @type json_by_name
  fields_to_index {
    "test1": null,
    "test2": "this_was_field_test2",
    "nested": {
      "test3": null,
      "test4": "this_was_nested_field_test4"
    }
  }
</filter>

Assuming the above config, then the plugin would act as follows:

Inputs

{"message": "{\"test1\": true}"}
{"message": "{\"test2\": true}"}
{"message": "{\"nested\": {\"test3\": true}}"}
{"message": "{\"nested\": {\"test4\": true}}"}

Outputs

{"message": "{\"test1\": true}", "test1": true}
{"message": "{\"test2\": true}", "this_was_field_test2": true}
{"message": "{\"nested\": {\"test3\": true}}", "nested.test3": true}
{"message": "{\"nested\": {\"test4\": true}}", "this_was_nested_field_test4": true}

More examples can be found in test/plugin/test_filter_json_by_name.rb

Testing

bundle install
rake

FAQs

Package last updated on 24 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.