fluent-plugin-elb-access-log 0.2.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +3 -0
- data/fluent-plugin-elb-access-log.gemspec +1 -1
- data/lib/fluent/plugin/in_elb_access_log.rb +27 -5
- data/lib/fluent_plugin_elb_access_log/version.rb +1 -1
- data/spec/in_elb_access_log_config_spec.rb +62 -0
- data/spec/in_elb_access_log_spec.rb +43 -18
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95d58c50d53bc1439025b341a16b9074e0c6f58f
|
4
|
+
data.tar.gz: 54795fa12a9d1cf36bb74b1900f978e864201a4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01be0d13bf848cee3166281aba86466b4c694c72d8134642a3af5792fd759aeb6a94a95ae1f9c00c00c9b42db66f5406a46bda5e273fd2b61d43dd6f62bbab60
|
7
|
+
data.tar.gz: f286515bbee08eef05c9f796b00c678a05d820722e395273ed36f8d104e57ce19d3d0007c92ac85142f9a00a5ce8edb096f38d814ce13da32e5d91c39a436b3f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -66,6 +66,9 @@ Or install it yourself as:
|
|
66
66
|
"received_bytes":0,
|
67
67
|
"sent_bytes":3,
|
68
68
|
"request":"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
69
|
+
"user_agent":"curl/7.30.0",
|
70
|
+
"ssl_cipher":"-",
|
71
|
+
"ssl_protocol":"-",
|
69
72
|
"request.method":"GET",
|
70
73
|
"request.uri":"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
71
74
|
"request.http_version":"HTTP/1.1",
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'fluentd'
|
22
|
-
spec.add_dependency 'aws-sdk', '~> 2
|
22
|
+
spec.add_dependency 'aws-sdk', '~> 2.1.2'
|
23
23
|
spec.add_dependency 'addressable'
|
24
24
|
spec.add_development_dependency 'bundler'
|
25
25
|
spec.add_development_dependency 'rake'
|
@@ -19,6 +19,9 @@ class Fluent::ElbAccessLogInput < Fluent::Input
|
|
19
19
|
'received_bytes' => :to_i,
|
20
20
|
'sent_bytes' => :to_i,
|
21
21
|
'request' => nil,
|
22
|
+
'user_agent' => nil,
|
23
|
+
'ssl_cipher' => nil,
|
24
|
+
'ssl_protocol' => nil,
|
22
25
|
}
|
23
26
|
|
24
27
|
unless method_defined?(:log)
|
@@ -63,11 +66,16 @@ class Fluent::ElbAccessLogInput < Fluent::Input
|
|
63
66
|
|
64
67
|
FileUtils.touch(@tsfile_path)
|
65
68
|
FileUtils.touch(@histfile_path)
|
69
|
+
tsfile_start_datetime = parse_tsfile
|
66
70
|
|
67
|
-
if @start_datetime
|
71
|
+
if @start_datetime and not tsfile_start_datetime
|
68
72
|
@start_datetime = Time.parse(@start_datetime).utc
|
69
73
|
else
|
70
|
-
@start_datetime
|
74
|
+
if @start_datetime
|
75
|
+
log.warn("start_datetime(#{@start_datetime}) is set. but tsfile datetime(#{tsfile_start_datetime}) is used")
|
76
|
+
end
|
77
|
+
|
78
|
+
@start_datetime = tsfile_start_datetime || Time.now.utc
|
71
79
|
end
|
72
80
|
|
73
81
|
@history = load_history
|
@@ -129,7 +137,7 @@ class Fluent::ElbAccessLogInput < Fluent::Input
|
|
129
137
|
end
|
130
138
|
|
131
139
|
unless @history.include?(obj.key)
|
132
|
-
access_log = client.get_object(bucket: @s3_bucket, key: obj.key).
|
140
|
+
access_log = client.get_object(bucket: @s3_bucket, key: obj.key).body.string
|
133
141
|
emit_access_log(access_log)
|
134
142
|
last_timestamp = logfile_datetime
|
135
143
|
@history.push(obj.key)
|
@@ -190,8 +198,14 @@ class Fluent::ElbAccessLogInput < Fluent::Input
|
|
190
198
|
|
191
199
|
# request
|
192
200
|
parsed[11] ||= ''
|
193
|
-
parsed[11].
|
194
|
-
parsed[11].
|
201
|
+
parsed[11].sub!(/\A"/, '')
|
202
|
+
parsed[11].sub!(/"(.*)\z/, '')
|
203
|
+
|
204
|
+
user_agent, ssl_cipher, ssl_protocol = $1.strip.split(' ', 3)
|
205
|
+
user_agent.sub!(/\A"/, '').sub!(/"\z/, '') if user_agent
|
206
|
+
parsed[12] = user_agent
|
207
|
+
parsed[13] = ssl_cipher
|
208
|
+
parsed[14] = ssl_protocol
|
195
209
|
rescue => e2
|
196
210
|
@log.warn("#{e.message}: #{line}")
|
197
211
|
end
|
@@ -205,6 +219,8 @@ class Fluent::ElbAccessLogInput < Fluent::Input
|
|
205
219
|
end
|
206
220
|
|
207
221
|
def split_address_port!(record, prefix)
|
222
|
+
address_port = record["#{prefix}_port"]
|
223
|
+
return unless address_port
|
208
224
|
address, port = record["#{prefix}_port"].split(':', 2)
|
209
225
|
record[prefix] = address
|
210
226
|
record["#{prefix}_port"] = port.to_i
|
@@ -245,6 +261,12 @@ class Fluent::ElbAccessLogInput < Fluent::Input
|
|
245
261
|
end
|
246
262
|
end
|
247
263
|
|
264
|
+
def parse_tsfile
|
265
|
+
Time.parse(File.read(@tsfile_path)).utc
|
266
|
+
rescue
|
267
|
+
nil
|
268
|
+
end
|
269
|
+
|
248
270
|
def client
|
249
271
|
return @client if @client
|
250
272
|
|
@@ -12,6 +12,7 @@ describe 'Fluent::ElbAccessLogInput#configure' do
|
|
12
12
|
allow(FileUtils).to receive(:touch)
|
13
13
|
allow(File).to receive(:read) { nil }
|
14
14
|
allow_any_instance_of(Fluent::ElbAccessLogInput).to receive(:load_history) { [] }
|
15
|
+
allow_any_instance_of(Fluent::ElbAccessLogInput).to receive(:parse_tsfile) { nil }
|
15
16
|
end
|
16
17
|
|
17
18
|
context 'when default' do
|
@@ -104,4 +105,65 @@ describe 'Fluent::ElbAccessLogInput#configure' do
|
|
104
105
|
expect(driver.instance.debug).to be_truthy
|
105
106
|
end
|
106
107
|
end
|
108
|
+
|
109
|
+
context 'when start_datetime is set' do
|
110
|
+
let(:start_datetime) { '2015-01-01 01:02:03 UTC' }
|
111
|
+
|
112
|
+
let(:fluentd_conf) do
|
113
|
+
{
|
114
|
+
account_id: account_id,
|
115
|
+
s3_bucket: s3_bucket,
|
116
|
+
region: region,
|
117
|
+
start_datetime: start_datetime
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
it do
|
122
|
+
expect(driver.instance.start_datetime).to eq Time.parse(start_datetime)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'when tsfile datetime is set' do
|
127
|
+
let(:tsfile_datetime) { '2015-02-01 01:02:03 UTC' }
|
128
|
+
|
129
|
+
let(:fluentd_conf) do
|
130
|
+
{
|
131
|
+
account_id: account_id,
|
132
|
+
s3_bucket: s3_bucket,
|
133
|
+
region: region,
|
134
|
+
start_datetime: tsfile_datetime
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
before do
|
139
|
+
allow_any_instance_of(Fluent::ElbAccessLogInput).to receive(:parse_tsfile) { Time.parse(tsfile_datetime) }
|
140
|
+
end
|
141
|
+
|
142
|
+
it do
|
143
|
+
expect(driver.instance.start_datetime).to eq Time.parse(tsfile_datetime)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'when start_datetime and tsfile datetime are set' do
|
148
|
+
let(:start_datetime) { '2015-01-01 01:02:03 UTC' }
|
149
|
+
let(:tsfile_datetime) { '2015-02-01 01:02:03 UTC' }
|
150
|
+
|
151
|
+
let(:fluentd_conf) do
|
152
|
+
{
|
153
|
+
account_id: account_id,
|
154
|
+
s3_bucket: s3_bucket,
|
155
|
+
region: region,
|
156
|
+
start_datetime: start_datetime
|
157
|
+
}
|
158
|
+
end
|
159
|
+
|
160
|
+
before do
|
161
|
+
allow_any_instance_of(Fluent::ElbAccessLogInput).to receive(:parse_tsfile) { Time.parse(tsfile_datetime) }
|
162
|
+
allow_any_instance_of(Fluent::Test::TestLogger).to receive(:warn).with("start_datetime(#{start_datetime}) is set. but tsfile datetime(#{tsfile_datetime}) is used")
|
163
|
+
end
|
164
|
+
|
165
|
+
it do
|
166
|
+
expect(driver.instance.start_datetime).to eq Time.parse(tsfile_datetime)
|
167
|
+
end
|
168
|
+
end
|
107
169
|
end
|
@@ -30,6 +30,7 @@ describe Fluent::ElbAccessLogInput do
|
|
30
30
|
Timecop.freeze(today)
|
31
31
|
allow_any_instance_of(Fluent::ElbAccessLogInput).to receive(:client) { client }
|
32
32
|
allow_any_instance_of(Fluent::ElbAccessLogInput).to receive(:load_history) { [] }
|
33
|
+
allow_any_instance_of(Fluent::ElbAccessLogInput).to receive(:parse_tsfile) { nil }
|
33
34
|
allow(FileUtils).to receive(:touch)
|
34
35
|
end
|
35
36
|
|
@@ -56,15 +57,15 @@ describe Fluent::ElbAccessLogInput do
|
|
56
57
|
context 'when access log exists' do
|
57
58
|
let(:today_access_log) do
|
58
59
|
<<-EOS
|
59
|
-
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" "curl/7.30.0"
|
60
|
-
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" "curl/7.30.0"
|
60
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
61
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
61
62
|
EOS
|
62
63
|
end
|
63
64
|
|
64
65
|
let(:tomorrow_access_log) do
|
65
66
|
<<-EOS
|
66
|
-
2015-05-25T19: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" "curl/7.30.0"
|
67
|
-
2015-05-25T19: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" "curl/7.30.0"
|
67
|
+
2015-05-25T19: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" "curl/7.30.0" ssl_cipher ssl_protocol
|
68
|
+
2015-05-25T19: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" "curl/7.30.0" ssl_cipher ssl_protocol
|
68
69
|
EOS
|
69
70
|
end
|
70
71
|
|
@@ -82,11 +83,11 @@ describe Fluent::ElbAccessLogInput do
|
|
82
83
|
end
|
83
84
|
|
84
85
|
expect(client).to receive(:get_object).with(bucket: s3_bucket, key: today_object_key) do
|
85
|
-
|
86
|
+
double('today_s3_object', body: StringIO.new(today_access_log))
|
86
87
|
end
|
87
88
|
|
88
89
|
expect(client).to receive(:get_object).with(bucket: s3_bucket, key: tomorrow_object_key) do
|
89
|
-
|
90
|
+
double('tomorrow_s3_object', body: StringIO.new(tomorrow_access_log))
|
90
91
|
end
|
91
92
|
|
92
93
|
expect(driver.instance).to receive(:save_timestamp).with(tomorrow)
|
@@ -113,6 +114,9 @@ describe Fluent::ElbAccessLogInput do
|
|
113
114
|
"sent_bytes"=>3,
|
114
115
|
"request"=>
|
115
116
|
"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
117
|
+
"user_agent"=>"curl/7.30.0",
|
118
|
+
"ssl_cipher"=>"ssl_cipher",
|
119
|
+
"ssl_protocol"=>"ssl_protocol",
|
116
120
|
"request.method"=>"GET",
|
117
121
|
"request.uri"=>
|
118
122
|
"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
@@ -141,6 +145,9 @@ describe Fluent::ElbAccessLogInput do
|
|
141
145
|
"sent_bytes"=>3,
|
142
146
|
"request"=>
|
143
147
|
"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
148
|
+
"user_agent"=>"curl/7.30.0",
|
149
|
+
"ssl_cipher"=>"ssl_cipher",
|
150
|
+
"ssl_protocol"=>"ssl_protocol",
|
144
151
|
"request.method"=>"GET",
|
145
152
|
"request.uri"=>
|
146
153
|
"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
@@ -169,6 +176,9 @@ describe Fluent::ElbAccessLogInput do
|
|
169
176
|
"sent_bytes"=>3,
|
170
177
|
"request"=>
|
171
178
|
"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
179
|
+
"user_agent"=>"curl/7.30.0",
|
180
|
+
"ssl_cipher"=>"ssl_cipher",
|
181
|
+
"ssl_protocol"=>"ssl_protocol",
|
172
182
|
"request.method"=>"GET",
|
173
183
|
"request.uri"=>
|
174
184
|
"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
@@ -197,6 +207,9 @@ describe Fluent::ElbAccessLogInput do
|
|
197
207
|
"sent_bytes"=>3,
|
198
208
|
"request"=>
|
199
209
|
"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
210
|
+
"user_agent"=>"curl/7.30.0",
|
211
|
+
"ssl_cipher"=>"ssl_cipher",
|
212
|
+
"ssl_protocol"=>"ssl_protocol",
|
200
213
|
"request.method"=>"GET",
|
201
214
|
"request.uri"=>
|
202
215
|
"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
@@ -234,7 +247,7 @@ describe Fluent::ElbAccessLogInput do
|
|
234
247
|
context 'when include bad URI' do
|
235
248
|
let(:today_access_log) do
|
236
249
|
<<-EOS
|
237
|
-
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" "curl/7.30.0"
|
250
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
238
251
|
EOS
|
239
252
|
end
|
240
253
|
|
@@ -247,7 +260,7 @@ describe Fluent::ElbAccessLogInput do
|
|
247
260
|
end
|
248
261
|
|
249
262
|
expect(client).to receive(:get_object).with(bucket: s3_bucket, key: today_object_key) do
|
250
|
-
|
263
|
+
double('today_s3_object', body: StringIO.new(today_access_log))
|
251
264
|
end
|
252
265
|
|
253
266
|
expect(driver.instance).to receive(:save_timestamp).with(today)
|
@@ -276,6 +289,9 @@ describe Fluent::ElbAccessLogInput do
|
|
276
289
|
"sent_bytes"=>3,
|
277
290
|
"request"=>
|
278
291
|
"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
292
|
+
"user_agent"=>"curl/7.30.0",
|
293
|
+
"ssl_cipher"=>"ssl_cipher",
|
294
|
+
"ssl_protocol"=>"ssl_protocol",
|
279
295
|
"request.method"=>"GET",
|
280
296
|
"request.uri"=>
|
281
297
|
"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
@@ -288,7 +304,7 @@ describe Fluent::ElbAccessLogInput do
|
|
288
304
|
context 'when access log exists (with tag option)' do
|
289
305
|
let(:today_access_log) do
|
290
306
|
<<-EOS
|
291
|
-
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" "curl/7.30.0"
|
307
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
292
308
|
EOS
|
293
309
|
end
|
294
310
|
|
@@ -311,7 +327,7 @@ describe Fluent::ElbAccessLogInput do
|
|
311
327
|
end
|
312
328
|
|
313
329
|
expect(client).to receive(:get_object).with(bucket: s3_bucket, key: today_object_key) do
|
314
|
-
|
330
|
+
double('today_s3_object', body: StringIO.new(today_access_log))
|
315
331
|
end
|
316
332
|
|
317
333
|
expect(driver.instance).to receive(:save_timestamp).with(today)
|
@@ -338,6 +354,9 @@ describe Fluent::ElbAccessLogInput do
|
|
338
354
|
"sent_bytes"=>3,
|
339
355
|
"request"=>
|
340
356
|
"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
357
|
+
"user_agent"=>"curl/7.30.0",
|
358
|
+
"ssl_cipher"=>"ssl_cipher",
|
359
|
+
"ssl_protocol"=>"ssl_protocol",
|
341
360
|
"request.method"=>"GET",
|
342
361
|
"request.uri"=>
|
343
362
|
"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
@@ -357,7 +376,7 @@ describe Fluent::ElbAccessLogInput do
|
|
357
376
|
context 'when access old log exists' do
|
358
377
|
let(:today_access_log) do
|
359
378
|
<<-EOS
|
360
|
-
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" "curl/7.30.0"
|
379
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
361
380
|
EOS
|
362
381
|
end
|
363
382
|
|
@@ -372,7 +391,7 @@ describe Fluent::ElbAccessLogInput do
|
|
372
391
|
end
|
373
392
|
|
374
393
|
expect(client).to receive(:get_object).with(bucket: s3_bucket, key: today_object_key) do
|
375
|
-
|
394
|
+
double('today_s3_object', body: StringIO.new(today_access_log))
|
376
395
|
end
|
377
396
|
|
378
397
|
expect(driver.instance).to_not receive(:save_timestamp)
|
@@ -399,6 +418,9 @@ describe Fluent::ElbAccessLogInput do
|
|
399
418
|
"sent_bytes"=>3,
|
400
419
|
"request"=>
|
401
420
|
"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
421
|
+
"user_agent"=>"curl/7.30.0",
|
422
|
+
"ssl_cipher"=>"ssl_cipher",
|
423
|
+
"ssl_protocol"=>"ssl_protocol",
|
402
424
|
"request.method"=>"GET",
|
403
425
|
"request.uri"=>
|
404
426
|
"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
@@ -418,7 +440,7 @@ describe Fluent::ElbAccessLogInput do
|
|
418
440
|
context 'when parse error' do
|
419
441
|
let(:today_access_log) do
|
420
442
|
<<-EOS
|
421
|
-
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" "curl/7.30.0"
|
443
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
422
444
|
EOS
|
423
445
|
end
|
424
446
|
|
@@ -431,7 +453,7 @@ describe Fluent::ElbAccessLogInput do
|
|
431
453
|
end
|
432
454
|
|
433
455
|
expect(client).to receive(:get_object).with(bucket: s3_bucket, key: today_object_key) do
|
434
|
-
|
456
|
+
double('today_s3_object', body: StringIO.new(today_access_log))
|
435
457
|
end
|
436
458
|
|
437
459
|
expect(driver.instance).to receive(:save_timestamp).with(today)
|
@@ -460,6 +482,9 @@ describe Fluent::ElbAccessLogInput do
|
|
460
482
|
"sent_bytes"=>3,
|
461
483
|
"request"=>
|
462
484
|
"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1",
|
485
|
+
"user_agent"=>"curl/7.30.0",
|
486
|
+
"ssl_cipher"=>"ssl_cipher",
|
487
|
+
"ssl_protocol"=>"ssl_protocol",
|
463
488
|
"request.method"=>"GET",
|
464
489
|
"request.uri"=>
|
465
490
|
"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/",
|
@@ -479,7 +504,7 @@ describe Fluent::ElbAccessLogInput do
|
|
479
504
|
context 'when access old log exists (timeout)' do
|
480
505
|
let(:today_access_log) do
|
481
506
|
<<-EOS
|
482
|
-
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" "curl/7.30.0"
|
507
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
483
508
|
EOS
|
484
509
|
end
|
485
510
|
|
@@ -506,7 +531,7 @@ describe Fluent::ElbAccessLogInput do
|
|
506
531
|
context 'when emitted log exists' do
|
507
532
|
let(:today_access_log) do
|
508
533
|
<<-EOS
|
509
|
-
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" "curl/7.30.0"
|
534
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
510
535
|
EOS
|
511
536
|
end
|
512
537
|
|
@@ -534,7 +559,7 @@ describe Fluent::ElbAccessLogInput do
|
|
534
559
|
describe 'history#length' do
|
535
560
|
let(:today_access_log) do
|
536
561
|
<<-EOS
|
537
|
-
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" "curl/7.30.0"
|
562
|
+
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" "curl/7.30.0" ssl_cipher ssl_protocol
|
538
563
|
EOS
|
539
564
|
end
|
540
565
|
|
@@ -549,7 +574,7 @@ describe Fluent::ElbAccessLogInput do
|
|
549
574
|
end
|
550
575
|
|
551
576
|
expect(client).to receive(:get_object).with(bucket: s3_bucket, key: today_object_key) do
|
552
|
-
|
577
|
+
double('today_s3_object', body: StringIO.new(today_access_log))
|
553
578
|
end
|
554
579
|
|
555
580
|
expect(driver.instance).to receive(:save_timestamp).with(today)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
@@ -30,20 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
- - <
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '2.1'
|
33
|
+
version: 2.1.2
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ~>
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
- - <
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '2.1'
|
40
|
+
version: 2.1.2
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: addressable
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|