fluent-plugin-elb-access-log 0.4.3 → 0.4.4
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 +4 -4
- data/README.md +1 -0
- data/lib/fluent/plugin/in_elb_access_log.rb +14 -5
- data/lib/fluent_plugin_elb_access_log/version.rb +1 -1
- data/spec/in_elb_access_log_alb_spec.rb +28 -1
- data/spec/in_elb_access_log_clb_spec.rb +27 -0
- data/spec/in_elb_access_log_config_spec.rb +3 -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: 4bcfed4ac9a254031fd9a23f2cf9439c5beeb4e8
|
4
|
+
data.tar.gz: f3e0a91ff1c7d76cf4d238b08863978bd181b31f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64e309331c88bf9735c27bf3d99921c37398e4c34f178dbfb067291d8973b86a45d4c7213467c68360b8192a37c63e07ca5dc57d3ef0ad183a555b76df6a7aa7
|
7
|
+
data.tar.gz: caecfbe52f8471cf1f061212a92511a26538dc2f72246b3d12e29af00976c739a884b70fb8e5cee32890d80acde0c69e4754f979fdbb45bac8f84a1c8a255211
|
data/README.md
CHANGED
@@ -83,6 +83,7 @@ class Fluent::Plugin::ElbAccessLogInput < Fluent::Input
|
|
83
83
|
config_param :filter_operator, :string, default: 'and'
|
84
84
|
config_param :type_cast, :bool, default: true
|
85
85
|
config_param :parse_request, :bool, default: true
|
86
|
+
config_param :split_addr_port, :bool, default: true
|
86
87
|
|
87
88
|
def configure(conf)
|
88
89
|
super
|
@@ -180,7 +181,7 @@ class Fluent::Plugin::ElbAccessLogInput < Fluent::Input
|
|
180
181
|
begin
|
181
182
|
access_log = MultipleFilesGzipReader.new(access_log)
|
182
183
|
|
183
|
-
# check gzip
|
184
|
+
# check gzip format
|
184
185
|
access_log.first
|
185
186
|
access_log.rewind
|
186
187
|
rescue Zlib::Error => e
|
@@ -270,7 +271,9 @@ class Fluent::Plugin::ElbAccessLogInput < Fluent::Input
|
|
270
271
|
|
271
272
|
if @type_cast
|
272
273
|
access_log_fields.each do |name, conv|
|
273
|
-
|
274
|
+
if conv and (value = record[name])
|
275
|
+
record[name] = value.send(conv)
|
276
|
+
end
|
274
277
|
end
|
275
278
|
end
|
276
279
|
|
@@ -349,9 +352,15 @@ class Fluent::Plugin::ElbAccessLogInput < Fluent::Input
|
|
349
352
|
def split_address_port!(record, prefix)
|
350
353
|
address_port = record["#{prefix}_port"]
|
351
354
|
return unless address_port
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
+
|
356
|
+
if @split_addr_port
|
357
|
+
address, port = address_port.split(':', 2)
|
358
|
+
record[prefix] = address
|
359
|
+
record["#{prefix}_port"] = port
|
360
|
+
else
|
361
|
+
record[prefix] = address_port
|
362
|
+
record.delete("#{prefix}_port")
|
363
|
+
end
|
355
364
|
end
|
356
365
|
|
357
366
|
def parse_request!(record)
|
@@ -369,7 +369,6 @@ https 2015-05-25T19:55:36.000000Z hoge 14.14.124.20:57673 10.0.199.184:80 0.0000
|
|
369
369
|
end
|
370
370
|
end
|
371
371
|
|
372
|
-
|
373
372
|
context 'without request parsing' do
|
374
373
|
let(:fluentd_conf) do
|
375
374
|
{
|
@@ -392,6 +391,34 @@ https 2015-05-25T19:55:36.000000Z hoge 14.14.124.20:57673 10.0.199.184:80 0.0000
|
|
392
391
|
is_expected.to match_table expected_emits_without_request_parsing
|
393
392
|
end
|
394
393
|
end
|
394
|
+
|
395
|
+
context 'without addr/port splitting' do
|
396
|
+
let(:fluentd_conf) do
|
397
|
+
{
|
398
|
+
interval: 0,
|
399
|
+
account_id: account_id,
|
400
|
+
s3_bucket: s3_bucket,
|
401
|
+
region: region,
|
402
|
+
start_datetime: (today - 1).to_s,
|
403
|
+
elb_type: 'alb',
|
404
|
+
split_addr_port: 'false',
|
405
|
+
}
|
406
|
+
end
|
407
|
+
|
408
|
+
it do
|
409
|
+
expected_emits_without_request_parsing = expected_emits.map do |tag, ts, h|
|
410
|
+
h.keys.select {|k| k =~ /_port\z/ }.each do |prefix_port|
|
411
|
+
prefix, _ = prefix_port.split('_', 2)
|
412
|
+
h[prefix] = h[prefix] + ':' + h[prefix_port].to_s
|
413
|
+
h.delete(prefix_port)
|
414
|
+
end
|
415
|
+
|
416
|
+
[tag, ts, h]
|
417
|
+
end
|
418
|
+
|
419
|
+
is_expected.to match_table expected_emits_without_request_parsing
|
420
|
+
end
|
421
|
+
end
|
395
422
|
end
|
396
423
|
|
397
424
|
context 'when include bad URI' do
|
@@ -358,6 +358,33 @@ describe Fluent::Plugin::ElbAccessLogInput do
|
|
358
358
|
is_expected.to match_table expected_emits_without_request_parsing
|
359
359
|
end
|
360
360
|
end
|
361
|
+
|
362
|
+
context 'without addr/port splitting' do
|
363
|
+
let(:fluentd_conf) do
|
364
|
+
{
|
365
|
+
interval: 0,
|
366
|
+
account_id: account_id,
|
367
|
+
s3_bucket: s3_bucket,
|
368
|
+
region: region,
|
369
|
+
start_datetime: (today - 1).to_s,
|
370
|
+
split_addr_port: 'false',
|
371
|
+
}
|
372
|
+
end
|
373
|
+
|
374
|
+
it do
|
375
|
+
expected_emits_without_request_parsing = expected_emits.map do |tag, ts, h|
|
376
|
+
h.keys.select {|k| k =~ /_port\z/ }.each do |prefix_port|
|
377
|
+
prefix, _ = prefix_port.split('_', 2)
|
378
|
+
h[prefix] = h[prefix] + ':' + h[prefix_port].to_s
|
379
|
+
h.delete(prefix_port)
|
380
|
+
end
|
381
|
+
|
382
|
+
[tag, ts, h]
|
383
|
+
end
|
384
|
+
|
385
|
+
is_expected.to match_table expected_emits_without_request_parsing
|
386
|
+
end
|
387
|
+
end
|
361
388
|
end
|
362
389
|
|
363
390
|
context 'when include bad URI' do
|
@@ -48,6 +48,7 @@ describe 'Fluent::Plugin::ElbAccessLogInput#configure' do
|
|
48
48
|
expect(driver.instance.filter_operator).to eq 'and'
|
49
49
|
expect(driver.instance.type_cast).to be_truthy
|
50
50
|
expect(driver.instance.parse_request).to be_truthy
|
51
|
+
expect(driver.instance.split_addr_port).to be_truthy
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
@@ -95,6 +96,7 @@ describe 'Fluent::Plugin::ElbAccessLogInput#configure' do
|
|
95
96
|
filter_operator: filter_operator,
|
96
97
|
type_cast: 'false',
|
97
98
|
parse_request: 'false',
|
99
|
+
split_addr_port: 'false',
|
98
100
|
}
|
99
101
|
end
|
100
102
|
|
@@ -121,6 +123,7 @@ describe 'Fluent::Plugin::ElbAccessLogInput#configure' do
|
|
121
123
|
expect(driver.instance.filter_operator).to eq filter_operator
|
122
124
|
expect(driver.instance.type_cast).to be_falsey
|
123
125
|
expect(driver.instance.parse_request).to be_falsey
|
126
|
+
expect(driver.instance.split_addr_port).to be_falsey
|
124
127
|
end
|
125
128
|
end
|
126
129
|
|
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.4.
|
4
|
+
version: 0.4.4
|
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-01-
|
11
|
+
date: 2018-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|