fluent-plugin-elb-access-log 0.6.0 → 0.6.1

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: d3a20dc8a60a8ce35bae8050d88f6f3cb89fd5cd
4
- data.tar.gz: b9df7709325ba5f796658df242b7d04727f65f96
3
+ metadata.gz: 2d393cd3a65c13a516101a1a7d21b184b78fc098
4
+ data.tar.gz: c4576223f3281ec52b9bec0b48f9a2a9edc882d0
5
5
  SHA512:
6
- metadata.gz: 41d7b97d9044b10ea91d65d20556024fa1f357e9e6ba1cb3c8e3827f553b5258ee8b96dc3e964acaba24eba0780f2078ed6517868eeaa28a2057a6efd0ecf7f1
7
- data.tar.gz: 9f3f1b43320c87f24112a6187e65c1bb293975b7f3db0816eb16c987bcdf4d5b6ad594d0950235d4b164760fc22a6b9997a99820cc158185d5e433528453a721
6
+ metadata.gz: 70759e109befd97543bfdd58aa1067a6baa27ed8e8e3231529672c5b1253ee1ab18633aa03d8b9107b336c300950e149f97574011bbc9de8841cddf1ea3deee7
7
+ data.tar.gz: 2603b714eb20a852e1a4b212cb06b9028ee27f6a42818022e7f6a0c3e47aa3ac22790574b20b313f451ce747299b1cde5b747e193f35e63a6643dbd154e0f2e7
data/README.md CHANGED
@@ -54,6 +54,7 @@ Or install it yourself as:
54
54
  #parse_request true
55
55
  #split_addr_port true
56
56
  #file_filter REGEXP
57
+ #request_separator .
57
58
  </source>
58
59
  ```
59
60
 
@@ -85,6 +85,7 @@ class FluentPluginElbAccessLogInput < Fluent::Input
85
85
  config_param :parse_request, :bool, default: true
86
86
  config_param :split_addr_port, :bool, default: true
87
87
  config_param :file_filter, :string, default: nil
88
+ config_param :request_separator, :string, default: '.'
88
89
 
89
90
  def configure(conf)
90
91
  super
@@ -377,9 +378,9 @@ class FluentPluginElbAccessLogInput < Fluent::Input
377
378
  return unless request
378
379
  method, uri, http_version = request.split(' ', 3)
379
380
 
380
- record['request.method'] = method
381
- record['request.uri'] = uri
382
- record['request.http_version'] = http_version
381
+ record["request#{@request_separator}method"] = method
382
+ record["request#{@request_separator}uri"] = uri
383
+ record["request#{@request_separator}http_version"] = http_version
383
384
 
384
385
  begin
385
386
  uri = Addressable::URI.parse(uri)
@@ -392,7 +393,7 @@ class FluentPluginElbAccessLogInput < Fluent::Input
392
393
  value = value.to_s
393
394
  end
394
395
 
395
- record["request.uri.#{key}"] = value
396
+ record["request#{@request_separator}uri#{@request_separator}#{key}"] = value
396
397
  end
397
398
  end
398
399
  rescue => e
@@ -1,3 +1,3 @@
1
1
  module FluentPluginElbAccessLog
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
@@ -419,6 +419,29 @@ https 2015-05-25T19:55:36.000000Z hoge 14.14.124.20:57673 10.0.199.184:80 0.0000
419
419
  is_expected.to match_table expected_emits_without_request_parsing
420
420
  end
421
421
  end
422
+
423
+ context 'with request_separator' do
424
+ let(:fluentd_conf) do
425
+ {
426
+ interval: 0,
427
+ account_id: account_id,
428
+ s3_bucket: s3_bucket,
429
+ region: region,
430
+ start_datetime: (today - 1).to_s,
431
+ elb_type: 'alb',
432
+ request_separator: '_'
433
+ }
434
+ end
435
+
436
+ it do
437
+ expected_emits_with_underscore = expected_emits.map do |tag, ts, h|
438
+ h = Hash[h.map {|k, v| [k.gsub('.', '_'), v] }]
439
+ [tag, ts, h]
440
+ end
441
+
442
+ is_expected.to match_table expected_emits_with_underscore
443
+ end
444
+ end
422
445
  end
423
446
 
424
447
  context 'with file_filter' do
@@ -385,6 +385,28 @@ describe FluentPluginElbAccessLogInput do
385
385
  is_expected.to match_table expected_emits_without_request_parsing
386
386
  end
387
387
  end
388
+
389
+ context 'with request_separator' do
390
+ let(:fluentd_conf) do
391
+ {
392
+ interval: 0,
393
+ account_id: account_id,
394
+ s3_bucket: s3_bucket,
395
+ region: region,
396
+ start_datetime: (today - 1).to_s,
397
+ request_separator: '_'
398
+ }
399
+ end
400
+
401
+ it do
402
+ expected_emits_with_underscore = expected_emits.map do |tag, ts, h|
403
+ h = Hash[h.map {|k, v| [k.gsub('.', '_'), v] }]
404
+ [tag, ts, h]
405
+ end
406
+
407
+ is_expected.to match_table expected_emits_with_underscore
408
+ end
409
+ end
388
410
  end
389
411
 
390
412
  context 'with file_filter' do
@@ -50,6 +50,8 @@ describe 'FluentPluginElbAccessLogInput#configure' do
50
50
  expect(driver.instance.parse_request).to be_truthy
51
51
  expect(driver.instance.split_addr_port).to be_truthy
52
52
  expect(driver.instance.filter).to be_nil
53
+ expect(driver.instance.file_filter).to be_nil
54
+ expect(driver.instance.request_separator).to eq '.'
53
55
  end
54
56
  end
55
57
 
@@ -72,6 +74,7 @@ describe 'FluentPluginElbAccessLogInput#configure' do
72
74
  let(:filter) { 'elb_status_code:^2' }
73
75
  let(:filter_operator) { 'or' }
74
76
  let(:file_filter) { '.*my-elb.*' }
77
+ let(:request_separator) { '_' }
75
78
 
76
79
  let(:fluentd_conf) do
77
80
  {
@@ -100,6 +103,7 @@ describe 'FluentPluginElbAccessLogInput#configure' do
100
103
  parse_request: 'false',
101
104
  split_addr_port: 'false',
102
105
  file_filter: file_filter,
106
+ request_separator: request_separator,
103
107
  }
104
108
  end
105
109
 
@@ -128,6 +132,7 @@ describe 'FluentPluginElbAccessLogInput#configure' do
128
132
  expect(driver.instance.parse_request).to be_falsey
129
133
  expect(driver.instance.split_addr_port).to be_falsey
130
134
  expect(driver.instance.file_filter).to eq Regexp.new(file_filter)
135
+ expect(driver.instance.request_separator).to eq request_separator
131
136
  end
132
137
  end
133
138
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elb-access-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-29 00:00:00.000000000 Z
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd