fluent-plugin-elb-access-log 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48b23acb9715aceaba32535f3ee24da9c672e1e0
4
- data.tar.gz: 161ce0f55e79b042af34171060d3e4d611f6acdb
3
+ metadata.gz: c7fc100990f59fc2792cbf0506b75ef400a1dd8f
4
+ data.tar.gz: 9e6bda33e638700957ee92c685c699859eb4dfab
5
5
  SHA512:
6
- metadata.gz: a9542814648731d30041c6bf7c9c30bfd822d3be137429628c2eb77aae0f02a7aeda538090065f5be6825cef415c1d60b18e62c07ea3b8edd3623d5be522a03f
7
- data.tar.gz: db0422ee4c1b5478eca4ee1531ae947685eb8584942ff264646dfa918147cce605b54625cb69e005caa90910819550a963d5adc8f8377bffa292546c31f71cb9
6
+ metadata.gz: f280a3e9212f18ce0446daacd6fffb6d9d3e59413458e3f6052acd240523a5c2db8d42ea2d73ed53f90fbc51abe554edc13c73eca2414c65bd8661839c6579a5
7
+ data.tar.gz: 26eb2f804a5245738cb6e7881ba3d454457ec3f575d8acc9d1b200da402f38a82eba0d263f0e42f4706dfeac18b3fcc62e50d40425c67b342c4cde93b5fa66e3
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency 'fluentd', '>= 0.14'
22
22
  spec.add_dependency 'aws-sdk-s3', '~> 1.8'
23
23
  spec.add_dependency 'addressable'
24
+ spec.add_dependency 'multiple_files_gzip_reader'
24
25
  spec.add_development_dependency 'bundler'
25
26
  spec.add_development_dependency 'rake'
26
27
  spec.add_development_dependency 'rspec', '>= 3.0.0'
@@ -4,7 +4,7 @@ require 'logger'
4
4
  require 'time'
5
5
  require 'addressable/uri'
6
6
  require 'aws-sdk-s3'
7
- require 'zlib'
7
+ require 'multiple_files_gzip_reader'
8
8
 
9
9
  require 'fluent/input'
10
10
  require 'fluent_plugin_elb_access_log/version'
@@ -166,13 +166,17 @@ class Fluent::Plugin::ElbAccessLogInput < Fluent::Input
166
166
 
167
167
  if obj.key.end_with?('.gz')
168
168
  begin
169
- access_log = Zlib::GzipReader.wrap(access_log, &:read)
169
+ access_log = MultipleFilesGzipReader.new(access_log)
170
+
171
+ # check gzip formta
172
+ access_log.first
173
+ access_log.rewind
170
174
  rescue Zlib::Error => e
171
175
  @log.warn("#{e.message}: #{access_log.inspect.slice(0, 64)}")
172
176
  next
173
177
  end
174
178
  else
175
- access_log = access_log.string
179
+ access_log = access_log.each_line
176
180
  end
177
181
 
178
182
  emit_access_log(access_log)
@@ -216,7 +220,9 @@ class Fluent::Plugin::ElbAccessLogInput < Fluent::Input
216
220
  def parse_log(access_log)
217
221
  parsed_access_log = []
218
222
 
219
- access_log.split("\n").each do |line|
223
+ access_log.each do |line|
224
+ line.chomp!
225
+
220
226
  case @elb_type
221
227
  when 'clb'
222
228
  line = parse_clb_line(line)
@@ -313,7 +319,7 @@ class Fluent::Plugin::ElbAccessLogInput < Fluent::Input
313
319
  end
314
320
 
315
321
  def sampling(access_log)
316
- access_log.split("\n").each_with_index.select {|row, i| (i % @sampling_interval).zero? }.map {|row, i| row }.join("\n")
322
+ access_log.each_with_index.select {|_, i| (i % @sampling_interval).zero? }.map(&:first)
317
323
  end
318
324
 
319
325
  def split_address_port!(record, prefix)
@@ -1,3 +1,3 @@
1
1
  module FluentPluginElbAccessLog
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: multiple_files_gzip_reader
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement