fluent-plugin-elb-access-log 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/fluent/plugin/in_elb_access_log.rb +5 -4
- data/lib/fluent_plugin_elb_access_log/version.rb +1 -1
- data/spec/in_elb_access_log_alb_spec.rb +23 -0
- data/spec/in_elb_access_log_clb_spec.rb +22 -0
- data/spec/in_elb_access_log_config_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d393cd3a65c13a516101a1a7d21b184b78fc098
|
4
|
+
data.tar.gz: c4576223f3281ec52b9bec0b48f9a2a9edc882d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70759e109befd97543bfdd58aa1067a6baa27ed8e8e3231529672c5b1253ee1ab18633aa03d8b9107b336c300950e149f97574011bbc9de8841cddf1ea3deee7
|
7
|
+
data.tar.gz: 2603b714eb20a852e1a4b212cb06b9028ee27f6a42818022e7f6a0c3e47aa3ac22790574b20b313f451ce747299b1cde5b747e193f35e63a6643dbd154e0f2e7
|
data/README.md
CHANGED
@@ -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[
|
381
|
-
record[
|
382
|
-
record[
|
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
|
396
|
+
record["request#{@request_separator}uri#{@request_separator}#{key}"] = value
|
396
397
|
end
|
397
398
|
end
|
398
399
|
rescue => e
|
@@ -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.
|
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-
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|