fluent-plugin-parse_request_body 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 09f546b793ebfd209dcf63dd79f27477e34ffac132a472617ff427a556f41dec
4
- data.tar.gz: 1834db8debc739aaf45e07564ac6bd6202556a9f69018f24243e37094a7bbf6c
3
+ metadata.gz: cb27080f5d4d14b0737d8bec5f175683388a9049b8f498c7f24908117a08b8f7
4
+ data.tar.gz: 2c528cc8b3e0eb5e8ca9fe54ba2a2e6bb5b13b139d7fb16777217881d674c583
5
5
  SHA512:
6
- metadata.gz: 6e8cdf1959c9bc4739d70c4fb4bb7c92251f8279e51a2125a3e379a82a7af29ccae1429b4e8b595af0dd9c475ff906482d95cadea658c819a8c5bb2169733bb8
7
- data.tar.gz: 36da38e9ffd9448b743fb549090be6662ca5627c65d4192ea6c426fa910631f920018c7c03aef865159cca61c7b8cf1f293bcbbf399f3c3976ea20234b1c8607
6
+ metadata.gz: e024e036343faa226bd4be4ff2037552f0849b82ed9f7df5c7f7c4b2e0c9547b89ac4c55f6ccc961219f1cc9b13a32f42f16f5397fcda49bfb1c0bf49c9f0341
7
+ data.tar.gz: dedab1341e47045f00eb8002ddc171412f3739d176a9acda27c5ee602940481a80fa093d878dd32d885b3baa7ff5f45ca6480924113b47a6253ea843a66442df
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'fluent-plugin-parse_request_body'
3
- gem.version = '0.0.6'
3
+ gem.version = '0.0.7'
4
4
  gem.authors = ['EkiSong']
5
5
  gem.email = ['yifriday0614@gmail.com']
6
6
  gem.homepage = 'https://github.com/yifriday/fluent-plugin-parse_request_body.git'
@@ -6,7 +6,7 @@ module Fluent::Plugin
6
6
  class ParseRequestBodyExtractor
7
7
 
8
8
  attr_reader :log
9
-
9
+
10
10
  def initialize(plugin, conf)
11
11
  @log = plugin.log
12
12
 
@@ -42,32 +42,11 @@ module Fluent::Plugin
42
42
  conf.elements.select { |element| element.name == 'record' }.each { |element|
43
43
  element.each_pair { |k, v|
44
44
  element.has_key?(k) # to suppress unread configuration warning
45
- v = v[1..v.size-2] if quoted_value?(v)
46
45
  @map[k] = v
47
- validate_json = Proc.new {
48
- begin
49
- dummy_text = Yajl::Encoder.encode('dummy_text')
50
- Yajl::Parser.parse(v.gsub(REGEXP_PLACEHOLDER_SCAN, dummy_text))
51
- rescue Yajl::ParseError => e
52
- message = "parse_body: failed to parse '#{v}' as json."
53
- log.error message, error: e
54
- raise Fluent::ConfigError, message
55
- end
56
- }
57
- validate_json.call if json?(v.tr('\'"\\', ''))
58
46
  }
59
47
  }
60
48
  end
61
49
 
62
- def json?(text)
63
- text.match(/^\[.+\]$/) || text.match(/^\{.+\}$/)
64
- end
65
-
66
- def quoted_value?(text)
67
- # to improbe compatibility with fluentd v1-config
68
- text.match(/(^'.+'$|^".+"$)/)
69
- end
70
-
71
50
  def add_record_field(record)
72
51
  return record if @map.values.first.nil?
73
52
  @map.each do |record_key, value|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-parse_request_body
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - EkiSong