Class: Fluent::TextParser::JSONTransformParser
- Inherits:
-
Object
- Object
- Fluent::TextParser::JSONTransformParser
- Includes:
- Configurable
- Defined in:
- lib/fluent/plugin/parser_json_transform.rb
Constant Summary collapse
- DEFAULTS =
[ 'nothing', 'flatten' ]
Instance Method Summary collapse
Instance Method Details
#call(text) ⇒ Object
24 25 26 27 |
# File 'lib/fluent/plugin/parser_json_transform.rb', line 24 def call(text) raw_json = JSON.parse(text) return nil, @transformer.transform(raw_json) end |
#configure(conf) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fluent/plugin/parser_json_transform.rb', line 10 def configure(conf) @transform_script = conf['transform_script'] if DEFAULTS.include?(@transform_script) @transform_script = "#{__dir__}/../../transform/#{@transform_script}.rb" elsif @transform_script == 'custom' @transform_script = conf['script_path'] end require @transform_script @transformer = JSONTransformer.new end |