fluent-plugin-elb-access-log 0.3.0 → 0.3.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: 95d58c50d53bc1439025b341a16b9074e0c6f58f
4
- data.tar.gz: 54795fa12a9d1cf36bb74b1900f978e864201a4c
3
+ metadata.gz: 68de9fd1d38e805c278098de81d3b3e188a2c80c
4
+ data.tar.gz: 73a076c5d9e5c89b1d863e9bcbdd154347f616c7
5
5
  SHA512:
6
- metadata.gz: 01be0d13bf848cee3166281aba86466b4c694c72d8134642a3af5792fd759aeb6a94a95ae1f9c00c00c9b42db66f5406a46bda5e273fd2b61d43dd6f62bbab60
7
- data.tar.gz: f286515bbee08eef05c9f796b00c678a05d820722e395273ed36f8d104e57ce19d3d0007c92ac85142f9a00a5ce8edb096f38d814ce13da32e5d91c39a436b3f
6
+ metadata.gz: 43b6f515b2fbf176e4fc5c214d7bac53b379c0e30b1d3133ce627a00fd67035e093fac5a505db322f54d1185b756d80e80f4fa0d4051d8e824644767f02794be
7
+ data.tar.gz: d77132f90688bbec203f347a03da69ffe6c3bf0147055d4362a0266e7275386da27c31e2df7aa7af6e42d6481f32515e192f0f077ac61981e7e31bd4739ce792
@@ -221,7 +221,7 @@ class Fluent::ElbAccessLogInput < Fluent::Input
221
221
  def split_address_port!(record, prefix)
222
222
  address_port = record["#{prefix}_port"]
223
223
  return unless address_port
224
- address, port = record["#{prefix}_port"].split(':', 2)
224
+ address, port = address_port.split(':', 2)
225
225
  record[prefix] = address
226
226
  record["#{prefix}_port"] = port.to_i
227
227
  end
@@ -1,3 +1,3 @@
1
1
  module FluentPluginElbAccessLog
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -499,6 +499,22 @@ describe Fluent::ElbAccessLogInput do
499
499
  end
500
500
 
501
501
  it { is_expected.to eq expected_emits }
502
+
503
+ context 'when no user_agent' do
504
+ let(:today_access_log) do
505
+ <<-EOS
506
+ 2015-05-24T19:55:36.000000Z hoge 14.14.124.20:57673 10.0.199.184:80 0.000053 0.000913 0.000036 200 200 0 3 "GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1"
507
+ EOS
508
+ end
509
+
510
+ before do
511
+ expected_emits[0][2]['user_agent'] = nil
512
+ expected_emits[0][2]['ssl_cipher'] = nil
513
+ expected_emits[0][2]['ssl_protocol'] = nil
514
+ end
515
+
516
+ it { is_expected.to eq expected_emits }
517
+ end
502
518
  end
503
519
 
504
520
  context 'when access old log exists (timeout)' do
@@ -600,4 +616,66 @@ describe Fluent::ElbAccessLogInput do
600
616
  it { is_expected.to eq 100 }
601
617
  end
602
618
  end
619
+
620
+ context 'when no user_agent' do
621
+ let(:today_access_log) do
622
+ <<-EOS
623
+ 2015-05-24T19:55:36.000000Z hoge 14.14.124.20:57673 10.0.199.184:80 0.000053 0.000913 0.000036 200 200 0 3 "GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1"
624
+ EOS
625
+ end
626
+
627
+ before do
628
+ expect(client).to receive(:list_objects).with(bucket: s3_bucket, prefix: yesterday_prefix) { [] }
629
+ expect(client).to receive(:list_objects).with(bucket: s3_bucket, prefix: tomorrow_prefix) { [] }
630
+
631
+ expect(client).to receive(:list_objects).with(bucket: s3_bucket, prefix: today_prefix) do
632
+ [double('today_objects', contents: [double('today_object', key: today_object_key)])]
633
+ end
634
+
635
+ expect(client).to receive(:get_object).with(bucket: s3_bucket, key: today_object_key) do
636
+ double('today_s3_object', body: StringIO.new(today_access_log))
637
+ end
638
+
639
+ expect(driver.instance).to receive(:save_timestamp).with(today)
640
+ expect(driver.instance).to receive(:save_history)
641
+
642
+ driver.run
643
+ end
644
+
645
+ let(:expected_emits) do
646
+ [["elb.access_log",
647
+ Time.parse('2015-05-24 19:55:36 UTC').to_i,
648
+ {"timestamp"=>"2015-05-24T19:55:36.000000Z",
649
+ "elb"=>"hoge",
650
+ "client"=>"14.14.124.20",
651
+ "client_port"=>57673,
652
+ "backend"=>"10.0.199.184",
653
+ "backend_port"=>80,
654
+ "request_processing_time"=>5.3e-05,
655
+ "backend_processing_time"=>0.000913,
656
+ "response_processing_time"=>3.6e-05,
657
+ "elb_status_code"=>200,
658
+ "backend_status_code"=>200,
659
+ "received_bytes"=>0,
660
+ "sent_bytes"=>3,
661
+ "request"=>
662
+ "GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
663
+ "user_agent"=>nil,
664
+ "ssl_cipher"=>nil,
665
+ "ssl_protocol"=>nil,
666
+ "request.method"=>"GET",
667
+ "request.uri"=>
668
+ "http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
669
+ "request.http_version"=>"HTTP/1.1",
670
+ "request.uri.scheme"=>"http",
671
+ "request.uri.user"=>nil,
672
+ "request.uri.host"=>"hoge-1876938939.ap-northeast-1.elb.amazonaws.com",
673
+ "request.uri.port"=>80,
674
+ "request.uri.path"=>"/",
675
+ "request.uri.query"=>nil,
676
+ "request.uri.fragment"=>nil}]]
677
+ end
678
+
679
+ it { is_expected.to eq expected_emits }
680
+ end
603
681
  end
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.3.0
4
+ version: 0.3.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: 2015-06-27 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd