fluent-plugin-parse_cookie 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb1f123f53af11b19c6757eedd4403c47573bbec
4
- data.tar.gz: bd28f11bb1961f4b73fd8c7f132aaaa0cf1f51e2
3
+ metadata.gz: 8ec24c3f1406c0f76e9bf509d099a2c30ea3c46b
4
+ data.tar.gz: ae6e8851749631f18f8358d76800966c406a6a0c
5
5
  SHA512:
6
- metadata.gz: ef95170bf55a2edf252427e283ae219a2bda9ea990ea9671e009143b0eb47479b4a2e39b437eddb5ec0df0eb3351f3e19b8597e9324a686a94709d07876c65dd
7
- data.tar.gz: 550322b83383b2a136a141ffcce22da1177c3bf24f9a6bffe4638d1837ff1e907ccb37437100aeb2ece606281041a3e4c7fe5f837a81841e9ab7ea5eaabd3bf0
6
+ metadata.gz: e148c332941e9aeef2ac7c35a93c9f824e406368878815b81d7a8a8cac3a59c0298c594660b07ea914d397458b120d890e44e2003a0323f2c1b27f26f9ba3e86
7
+ data.tar.gz: 38470db1db6904f700338a0a42257f830c421b4ff8ad3289e5c718cb04f2f6570fb16fc40af1c57d7706dc6fa5cd592caf366e6ef353ca6c6cc628b3bbf3d5fc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
- ## 0.0.1 (2015/02/11)
1
+ ## 0.0.3 (2015/03/31)
2
+ sub_key option
3
+
4
+ ## 0.0.2 (2015/02/11)
2
5
  fix require 'cgi'
3
6
 
4
7
  ## 0.0.1 (2015/02/11)
5
- First release
8
+ First release
data/README.md CHANGED
@@ -127,6 +127,31 @@ output
127
127
  "array": ["123", "abc", "1a2b"]
128
128
  }
129
129
  ```
130
+
131
+ If you want create key with parsed data.
132
+ ```
133
+ <match foo.**>
134
+ type parse_cookie
135
+ key cookie
136
+ sub_key cookie_parsed
137
+ </match>
138
+
139
+ input
140
+ "test" {
141
+ "cookie": "foo=baz; empty=; array=123; array=abc; array=1a2b"
142
+ }
143
+
144
+ output
145
+ "parsed_cookie.test" {
146
+ "cookie": "foo=baz; empty=; array=123; array=abc; array=1a2b",
147
+ "cookie_parsed": {
148
+ "foo": ["baz"],
149
+ "empty": [],
150
+ "array": ["123", "abc", "1a2b"]
151
+ }
152
+ }
153
+ ```
154
+
130
155
  ## Option Parameters
131
156
 
132
157
  ### key :String
@@ -151,6 +176,10 @@ You want to remove cookie.
151
176
  You must be this option setting true.
152
177
  Default value is false.
153
178
 
179
+ ### sub_key :String
180
+ You want to put parsed data into separate key.
181
+ Default value is false.
182
+
154
183
  ## Change log
155
184
  See [CHANGELOG.md](https://github.com/h-michael-z/fluent-plugin-parse_cookie/blob/master/CHANGELOG.md) for details.
156
185
 
@@ -6,6 +6,7 @@ module Fluent
6
6
  config_param :remove_empty_array, :bool, :default => false
7
7
  config_param :single_value_to_string, :bool, :default => false
8
8
  config_param :remove_cookie, :bool, :default => false
9
+ config_param :sub_key, :string, :default => nil
9
10
 
10
11
  def initialize
11
12
  super
@@ -60,7 +61,11 @@ module Fluent
60
61
  end
61
62
  end
62
63
  end
63
- record.merge!(hash)
64
+
65
+ target = sub_key ? (record[sub_key] ||= {}) : record
66
+
67
+ target.merge!(hash)
68
+
64
69
  record.delete(key) if remove_cookie
65
70
  end
66
71
  return record
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
  module ParseCookie
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -170,4 +170,28 @@ class ParseCookieOutputTest < Test::Unit::TestCase
170
170
  assert_equal COOKIE, record['cookie']
171
171
  end
172
172
  end
173
- end
173
+
174
+ def test_sub_key
175
+ conf = %[
176
+ key cookie
177
+ sub_key cookie_parsed
178
+ remove_empty_array true
179
+ single_value_to_string true
180
+ ]
181
+
182
+ record = {
183
+ 'cookie' => COOKIE,
184
+ }
185
+
186
+ emits = emit(conf, record)
187
+
188
+ emits.each_with_index do |(tag, time, record), i|
189
+ assert_equal 'parsed_cookie.test', tag
190
+ assert_equal 'tmp', record['cookie_parsed']['temporary']
191
+ assert_equal nil, record['cookie_parsed']['empty']
192
+ assert_equal 'miahcel', record['cookie_parsed']['__test']
193
+ assert_equal ['123', 'abc', '1a2b'], record['cookie_parsed']['array']
194
+ assert_equal COOKIE, record['cookie']
195
+ end
196
+ end
197
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-parse_cookie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hirokazu Hata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -174,11 +174,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  requirements: []
176
176
  rubyforge_project:
177
- rubygems_version: 2.2.2
177
+ rubygems_version: 2.4.5
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: Fluentd plugin to parse cookie
181
181
  test_files:
182
182
  - test/helper.rb
183
183
  - test/plugin/test_out_parse_cookie.rb
184
- has_rdoc: