Sha256: 4585076f07233d1ad0755cf9bb4a71ecef09dd8b178ceffa4ff010adcb1faf0e

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

require "fluent/plugin/output"
require "fluent/plugin/parse_request_body_extractor"

module Fluent::Plugin
  class ParseRequestBodyOutput < Fluent::Plugin::Output
    include Fluent::HandleTagNameMixin

    Fluent::Plugin.register_output('parse_request_body', self)

    helpers :event_emitter

    desc "point a key whose value contains URL string."
    config_param :key,    :string
    desc "If set, only the key/value whose key is included only will be added to the record."
    config_param :only,   :string, default: nil
    desc "If set, the key/value whose key is included except will NOT be added to the record."
    config_param :except, :string, default: nil
    desc "If set to true, the original key url will be discarded from the record."
    config_param :discard_key, :bool, default: false
    desc "Prefix of fields."
    config_param :add_field_prefix, :string, default: nil
    desc "If set to true, permit blank key."
    config_param :permit_blank_key, :bool, default: false

    def configure(conf)
      super
      @extractor = Fluent::Plugin::ParseRequestBodyExtractor.new(self, conf)
    end

    def multi_workers_ready?
      true
    end

    def filter_record(tag, time, record)
      record = @extractor.add_query_params_field(record)
      super(tag, time, record)
    end

    def process(tag, es)
      es.each do |time, record|
        t = tag.dup
        filter_record(t, time, record)
        router.emit(t, time, record)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fluent-plugin-parse_request_body-0.0.7 lib/fluent/plugin/out_parse_request_body.rb
fluent-plugin-parse_request_body-0.0.6 lib/fluent/plugin/out_parse_request_body.rb
fluent-plugin-parse_request_body-0.0.5 lib/fluent/plugin/out_parse_request_body.rb
fluent-plugin-parse_request_body-0.0.4 lib/fluent/plugin/out_parse_request_body.rb
fluent-plugin-parse_request_body-0.0.3 lib/fluent/plugin/out_parse_request_body.rb
fluent-plugin-parse_request_body-0.0.2 lib/fluent/plugin/out_parse_request_body.rb
fluent-plugin-parse_request_body-0.0.1 lib/fluent/plugin/out_parse_request_body.rb