fluent-plugin-elb-log 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-elb-log.gemspec +1 -1
- data/lib/fluent/plugin/in_elb_log.rb +1 -1
- data/test/plugin/in_elb_log.rb +28 -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: '098789aaeb055a519eb134eacc836b136871a0ff'
|
4
|
+
data.tar.gz: 19c18c2c0b1e40b9910d96b82f775e411456224b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc08af197a894d4029acad72fc8130ec420978b2dee02d394b81de5392368c043d3c7caf7b24339bf305aa302a586b538158cbc82eddf99e29961246e6e8c2d9
|
7
|
+
data.tar.gz: b449eaa8f96fa886db6de387d365de1d6896e88d60ccf721c67b93f096a7da6a8e60c06ed43e0e4cc1955c30d457196d4a3bd6fafc8f62084be5e7164956ff81
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-elb-log"
|
7
|
-
spec.version = "0.
|
7
|
+
spec.version = "0.7.0"
|
8
8
|
spec.authors = ["shinsaka"]
|
9
9
|
spec.email = ["shinx1265@gmail.com"]
|
10
10
|
spec.summary = "Amazon ELB log input plugin"
|
@@ -11,7 +11,7 @@ class Fluent::Plugin::Elb_LogInput < Fluent::Plugin::Input
|
|
11
11
|
helpers :timer
|
12
12
|
|
13
13
|
LOGFILE_REGEXP = /^((?<prefix>.+?)\/|)AWSLogs\/(?<account_id>[0-9]{12})\/elasticloadbalancing\/(?<region>.+?)\/(?<logfile_date>[0-9]{4}\/[0-9]{2}\/[0-9]{2})\/[0-9]{12}_elasticloadbalancing_.+?_(?<logfile_elb_name>[^_]+)_(?<elb_timestamp>[0-9]{8}T[0-9]{4}Z)_(?<elb_ip_address>.+?)_(?<logfile_hash>.+)\.log(.gz)?$/
|
14
|
-
ACCESSLOG_REGEXP = /^((?<type>[a-z0-9]+) )?(?<time>\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{6}Z) (?<elb>.+?) (?<client>[^ ]+)\:(?<client_port>.+?) (?<backend>.+?)(\:(?<backend_port>.+?))? (?<request_processing_time>.+?) (?<backend_processing_time>.+?) (?<response_processing_time>.+?) (?<elb_status_code>.+?) (?<backend_status_code>.+?) (?<received_bytes>.+?) (?<sent_bytes>.+?) \"(?<request_method>.+?) (?<request_uri>.+?) (?<request_protocol>.+?)\"( \"(?<user_agent>.*?)\" (?<ssl_cipher>.+?) (?<ssl_protocol>[^\s]+)( (?<target_group_arn>arn
|
14
|
+
ACCESSLOG_REGEXP = /^((?<type>[a-z0-9]+) )?(?<time>\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{6}Z) (?<elb>.+?) (?<client>[^ ]+)\:(?<client_port>.+?) (?<backend>.+?)(\:(?<backend_port>.+?))? (?<request_processing_time>.+?) (?<backend_processing_time>.+?) (?<response_processing_time>.+?) (?<elb_status_code>.+?) (?<backend_status_code>.+?) (?<received_bytes>.+?) (?<sent_bytes>.+?) \"(?<request_method>.+?) (?<request_uri>.+?) (?<request_protocol>.+?)\"( \"(?<user_agent>.*?)\" (?<ssl_cipher>.+?) (?<ssl_protocol>[^\s]+)( (?<target_group_arn>arn:\S+) (?<trace_id>[^\s]+))?(| (?<option3>.*)))?/
|
15
15
|
|
16
16
|
config_param :access_key_id, :string, default: nil, secret: true
|
17
17
|
config_param :secret_access_key, :string, default: nil, secret: true
|
data/test/plugin/in_elb_log.rb
CHANGED
@@ -225,4 +225,32 @@ class Elb_LogInputTest < Test::Unit::TestCase
|
|
225
225
|
assert_equal('"Root=1-590c7929-4eb4cb393d46a01d22db8473"', m[:trace_id])
|
226
226
|
assert_equal(nil, m[:option3])
|
227
227
|
end
|
228
|
+
|
229
|
+
def test_grp_and_trace_fileld
|
230
|
+
log = 'http 2018-03-15T03:50:00.337397Z app/elbname/aabbccdd9988 10.248.9.92:54000 10.248.9.77:80 0.001 0.002 0.003 200 200 686 6476 "GET http://services-lb.nottherealsite.net:80/svc/example HTTP/1.1" "-" - - arn:aws:elasticloadbalancing:us-east-1:123456789123:targetgroup/example-service/1234abcd1234abcd "Root=1-xxxxxxxx-yyyyyyyyyyyyyyyyyyyzzzzz" "-" "-" 3'
|
231
|
+
m = Fluent::Plugin::Elb_LogInput::ACCESSLOG_REGEXP.match(log)
|
232
|
+
assert_equal('http', m[:type])
|
233
|
+
assert_equal('2018-03-15T03:50:00.337397Z', m[:time])
|
234
|
+
assert_equal('app/elbname/aabbccdd9988', m[:elb])
|
235
|
+
assert_equal('10.248.9.92', m[:client])
|
236
|
+
assert_equal('54000', m[:client_port])
|
237
|
+
assert_equal('10.248.9.77', m[:backend])
|
238
|
+
assert_equal('80', m[:backend_port])
|
239
|
+
assert_equal('0.001', m[:request_processing_time])
|
240
|
+
assert_equal('0.002', m[:backend_processing_time])
|
241
|
+
assert_equal('0.003', m[:response_processing_time])
|
242
|
+
assert_equal('200', m[:elb_status_code])
|
243
|
+
assert_equal('200', m[:backend_status_code])
|
244
|
+
assert_equal('686', m[:received_bytes])
|
245
|
+
assert_equal('6476', m[:sent_bytes])
|
246
|
+
assert_equal('GET', m[:request_method])
|
247
|
+
assert_equal('http://services-lb.nottherealsite.net:80/svc/example', m[:request_uri])
|
248
|
+
assert_equal('HTTP/1.1', m[:request_protocol])
|
249
|
+
assert_equal('-', m[:user_agent])
|
250
|
+
assert_equal('-', m[:ssl_cipher])
|
251
|
+
assert_equal('-', m[:ssl_protocol])
|
252
|
+
assert_equal('arn:aws:elasticloadbalancing:us-east-1:123456789123:targetgroup/example-service/1234abcd1234abcd', m[:target_group_arn])
|
253
|
+
assert_equal('"Root=1-xxxxxxxx-yyyyyyyyyyyyyyyyyyyzzzzz"', m[:trace_id])
|
254
|
+
assert_equal(nil, m[:option3])
|
255
|
+
end
|
228
256
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-elb-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shinsaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|