fluent-plugin-cloudfront-log 0.0.4 → 0.0.5

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: 4d3261d6109af600ee45feae079ad583fb586435
4
- data.tar.gz: 2c237fc30d3ac111a3d06fb15271fc9d44268903
3
+ metadata.gz: 5a826fe802133f58af53f3c1d168af22c6a6014a
4
+ data.tar.gz: 6b58d43be522a4f7937c44b42a6e8cb614fc7744
5
5
  SHA512:
6
- metadata.gz: 24cb6dbbb51e4f6a736eaf6b30adf12a3ffa48654828581c219bc5fabad49f7340c5029b578a389db471b5b079087d26e31e2f7aa982e76a5e4a2b9df69403f5
7
- data.tar.gz: bfb0c00d90770537cc8b9510f9d85bc0474fb7fc6f481d8982989b4767080e7d6252585ac005c7c2212702621529858aba050032065779b61403a1b428c278e6
6
+ metadata.gz: b201b556e0d72ce801a1911b7a341c444767b0f98c05e0ccb0db2a3e850f0e75fd904db09aa2c8a87b32ca61a686dc63ea7d521d91a06a7e96d195d4ea45e0aa
7
+ data.tar.gz: 158fba1b70f4079bf545bbff5fd51bbda13dfc01606c7281e21dcaf8abbbecc394391868cc52d93dc7c4b92bba2701ef3e03780be0bda710af2feca2a5c6dd8f
data/README.md CHANGED
@@ -48,6 +48,9 @@ This is a FluentD builtin.
48
48
  #### thread_num
49
49
  The number of threads to create to concurrently process the S3 objects. Defaults to 4.
50
50
 
51
+ #### s3_get_max
52
+ Control the size of the S3 fetched list on each iteration. Default to 200.
53
+
51
54
  #### delimiter
52
55
  You shouldn't have to specify delimiter at all but this option is provided and passed to the S3 client in the event that you have a weird delimiter in your log file names. Defaults to `nil`.
53
56
 
@@ -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-cloudfront-log"
7
- spec.version = "0.0.4"
7
+ spec.version = "0.0.5"
8
8
  spec.authors = ["kubihie"]
9
9
  spec.email = ["kubihie@gmail.com"]
10
10
 
@@ -13,6 +13,7 @@ class Fluent::Cloudfront_LogInput < Fluent::Input
13
13
  config_param :delimiter, :string, :default => nil
14
14
  config_param :verbose, :string, :default => false
15
15
  config_param :thread_num, :integer, :default => 4
16
+ config_param :s3_get_max, :integer, :default => 200
16
17
 
17
18
  def initialize
18
19
  super
@@ -146,27 +147,33 @@ class Fluent::Cloudfront_LogInput < Fluent::Input
146
147
 
147
148
  def input
148
149
  log.info("CloudFront Begining input going to list S3")
149
- client.list_objects(:bucket => @log_bucket, :prefix => @log_prefix , :delimiter => @delimiter).each do |list|
150
+ begin
151
+ s3_list = client.list_objects(:bucket => @log_bucket, :prefix => @log_prefix , :delimiter => @delimiter, :max_keys => @s3_get_max)
152
+ rescue => e
153
+ log.warn("S3 GET list error. #{e.message}")
154
+ return
155
+ end
156
+ log.info("Finished S3 get list")
150
157
  queue = Queue.new
151
158
  threads = []
152
- list.contents.each do |content|
153
- queue << content
154
- end
155
- # BEGINS THREADS
156
- @thread_num.times do
157
- threads << Thread.new do
158
- until queue.empty?
159
- work_unit = queue.pop(true) rescue nil
160
- if work_unit
161
- process_content(work_unit)
162
- end
163
- end
159
+ log.debug("S3 List size: #{s3_list.contents.length}")
160
+ s3_list.contents.each do |content|
161
+ queue << content
162
+ end
163
+ # BEGINS THREADS
164
+ @thread_num.times do
165
+ threads << Thread.new do
166
+ until queue.empty?
167
+ work_unit = queue.pop(true) rescue nil
168
+ if work_unit
169
+ process_content(work_unit)
164
170
  end
165
171
  end
166
- log.debug("CloudFront Waiting for Threads to finish...")
167
- threads.each { |t| t.join }
168
- log.debug("CloudFront Finished")
169
- end
172
+ end
173
+ end
174
+ log.debug("CloudFront Waiting for Threads to finish...")
175
+ threads.each { |t| t.join }
176
+ log.debug("CloudFront Finished")
170
177
  end
171
178
 
172
179
  class TimerWatcher < Coolio::TimerWatcher
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cloudfront-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - kubihie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-21 00:00:00.000000000 Z
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd