Class: Fluent::Plugin::ParseRequestBodyExtractor
- Inherits:
-
Object
- Object
- Fluent::Plugin::ParseRequestBodyExtractor
- Defined in:
- lib/fluent/plugin/parse_request_body_extractor.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
readonly
Returns the value of attribute log.
Instance Method Summary collapse
-
#add_query_params_field(record) ⇒ Object
解析方法#.
-
#initialize(plugin, conf) ⇒ ParseRequestBodyExtractor
constructor
初始化解析器#.
Constructor Details
#initialize(plugin, conf) ⇒ ParseRequestBodyExtractor
初始化解析器#
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fluent/plugin/parse_request_body_extractor.rb', line 11 def initialize(plugin, conf) @log = plugin.log if plugin.is_a?(Fluent::Plugin::Output) unless have_tag_option?(plugin) raise Fluent::ConfigError, "out_parse_request_body: At least one of remove_tag_prefix/remove_tag_suffix/add_tag_prefix/add_tag_suffix is required to be set." end end #从配置中读取配置选项# @key = plugin.key @only = plugin.only @except = plugin.except @discard_key = plugin.discard_key @add_field_prefix = plugin.add_field_prefix @permit_blank_key = plugin.permit_blank_key @array_value = plugin.array_value @array_value_key = plugin.array_value_key @replace_key = plugin.replace_key #初始化白名单# if @only @include_keys = @only.split(/\s*,\s*/).inject({}) do |hash, i| hash[i] = true hash end end #初始化黑名单# if @except @exclude_keys = @except.split(/\s*,\s*/).inject({}) do |hash, i| hash[i] = true hash end end #初始化需要被组合的key# if @array_value_key if @array_value @include_array_value = @array_value.split(/\s*,\s*/).inject({}) do |hash, i| hash[i] = true hash end end end end |
Instance Attribute Details
#log ⇒ Object (readonly)
Returns the value of attribute log.
8 9 10 |
# File 'lib/fluent/plugin/parse_request_body_extractor.rb', line 8 def log @log end |
Instance Method Details
#add_query_params_field(record) ⇒ Object
解析方法#
60 61 62 63 64 65 66 |
# File 'lib/fluent/plugin/parse_request_body_extractor.rb', line 60 def add_query_params_field(record) return record unless record[@key] add_query_params(record[@key], record) replace_record_by_key(record) if @replace_key record.delete(@key) if @discard_key record end |