fluent-plugin-parserequestbody 0.0.1 → 0.0.2
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
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0dfaa791893146db7d82681e2ed268f29a057daf
|
|
4
|
+
data.tar.gz: e5b0011c3d630c5cfa4a77fb0ac34962e9d01571
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67894f81130dcfcf2f172dda141e6a54b4c2a499fc43907f1bec7a7a7a47113d5f6096c6aab743466342e8e0c5f6e4f65d9dac4748e1c04ef5e88667a95a12fb
|
|
7
|
+
data.tar.gz: 1a88ad102d3cfba4f546ff4e99a8b5a57145e64432eda39f2e4b6f2ccc7fd65c97c8461c97966f4f89b3264dc8b783ee7b685f40851e591aab33c7e88fe8f333
|
|
@@ -5,11 +5,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "fluent-plugin-parserequestbody"
|
|
8
|
-
spec.version = "0.0.
|
|
8
|
+
spec.version = "0.0.2"
|
|
9
9
|
spec.authors = ["Keiichiro Nagashima"]
|
|
10
10
|
spec.email = ["k16.nagshima@gmail.com"]
|
|
11
|
-
spec.summary = %q{Fluentd plugin}
|
|
12
|
-
spec.description = %q{Fluentd plugin}
|
|
11
|
+
spec.summary = %q{Fluentd plugin for parse request body}
|
|
12
|
+
spec.description = %q{Fluentd plugin for parse request body}
|
|
13
13
|
spec.homepage = "https://github.com/k1row/fluent-plugin-requestbody.git"
|
|
14
14
|
spec.license = "MIT"
|
|
15
15
|
|
|
@@ -7,58 +7,42 @@ class Fluent::ParseRequestbodyInput < Fluent::TailInput
|
|
|
7
7
|
|
|
8
8
|
def parse_line(line)
|
|
9
9
|
elements = line.split("\t")
|
|
10
|
-
$stderr.puts elements
|
|
11
10
|
|
|
12
11
|
time = elements.shift
|
|
13
|
-
$stderr.puts time
|
|
14
12
|
time = Time.strptime(time, @time_format).to_i
|
|
15
13
|
|
|
16
|
-
# [k1, v1, k2, v2, ...] -> {k1=>v1, k2=>v2, ...}
|
|
17
14
|
record = {}
|
|
18
15
|
while (k = elements.shift) && (v = elements.shift)
|
|
19
16
|
if(k =~ /request_body/)
|
|
20
|
-
$stderr.puts "found in K"
|
|
21
17
|
self.parseRequestBody(k, record)
|
|
22
18
|
elsif(v =~ /request_body/)
|
|
23
|
-
$stderr.puts "found in v"
|
|
24
19
|
self.parseRequestBody(j, record)
|
|
25
20
|
end
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
kVal = k.split(":")
|
|
23
|
+
record[kVal[0]] = kVal[1]
|
|
24
|
+
|
|
25
|
+
vVal = v.split(":")
|
|
26
|
+
record[vVal[0]] = vVal[1]
|
|
28
27
|
end
|
|
29
28
|
|
|
30
|
-
$stderr.puts "**************"
|
|
31
29
|
$stderr.puts record
|
|
32
30
|
return time, record
|
|
33
31
|
end
|
|
34
32
|
|
|
35
33
|
protected
|
|
36
34
|
def parseRequestBody(elements, record)
|
|
37
|
-
|
|
38
|
-
$stderr.puts "--------------"
|
|
39
|
-
$stderr.puts elements
|
|
40
|
-
|
|
41
|
-
$stderr.puts "++++++++++++++"
|
|
42
35
|
result = Hash[elements.split("\t").map{|f| f.split(":", 2)}]
|
|
43
36
|
result.each_key do |key|
|
|
44
37
|
$stderr.puts "#{key}"
|
|
45
38
|
end
|
|
46
39
|
|
|
47
40
|
result.each_value do |value|
|
|
48
|
-
|
|
49
|
-
$stderr.puts "@@@@@@@@@@@@@@"
|
|
50
|
-
$stderr.puts value
|
|
51
|
-
|
|
52
41
|
result2 = Hash[value.split(",").map{|f| f.split(":", 2)}]
|
|
53
|
-
$stderr.puts "%%%%%%%%%%%%%%"
|
|
54
|
-
$stderr.puts result2
|
|
55
42
|
result2.each do |key2, value2|
|
|
56
43
|
gsubKey = key2.gsub(/(\\x0A\\x22|\\x0A|\\x22|\{)/, "").strip
|
|
57
44
|
gsubValue = value2.gsub(/(\\x0A\\x22|\\x0A|\\x22|\{)/, "").strip
|
|
58
|
-
|
|
59
|
-
$stderr.puts gsubKey
|
|
60
|
-
$stderr.puts gsubValue
|
|
61
|
-
record["#{gsubKey}" + ":" + "#{gsubValue}"] = ""
|
|
45
|
+
record[gsubKey] = gsubValue
|
|
62
46
|
end
|
|
63
47
|
end
|
|
64
48
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fluent-plugin-parserequestbody
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Keiichiro Nagashima
|
|
@@ -66,7 +66,7 @@ dependencies:
|
|
|
66
66
|
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '0'
|
|
69
|
-
description: Fluentd plugin
|
|
69
|
+
description: Fluentd plugin for parse request body
|
|
70
70
|
email:
|
|
71
71
|
- k16.nagshima@gmail.com
|
|
72
72
|
executables: []
|
|
@@ -81,7 +81,7 @@ files:
|
|
|
81
81
|
- README.md
|
|
82
82
|
- Rakefile
|
|
83
83
|
- fluent-plugin-parserequestbody.gemspec
|
|
84
|
-
- lib/fluent/plugin/
|
|
84
|
+
- lib/fluent/plugin/in_parserequestbody.rb
|
|
85
85
|
- spec/fluent/plugin/parserequestbody_spec.rb
|
|
86
86
|
- spec/spec_helper.rb
|
|
87
87
|
homepage: https://github.com/k1row/fluent-plugin-requestbody.git
|
|
@@ -107,7 +107,7 @@ rubyforge_project:
|
|
|
107
107
|
rubygems_version: 2.2.2
|
|
108
108
|
signing_key:
|
|
109
109
|
specification_version: 4
|
|
110
|
-
summary: Fluentd plugin
|
|
110
|
+
summary: Fluentd plugin for parse request body
|
|
111
111
|
test_files:
|
|
112
112
|
- spec/fluent/plugin/parserequestbody_spec.rb
|
|
113
113
|
- spec/spec_helper.rb
|