fluent-plugin-cloudfront-log 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/fluent-plugin-cloudfront-log.gemspec +1 -1
- data/lib/fluent/plugin/in_cloudfront_log.rb +24 -17
- 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: 5a826fe802133f58af53f3c1d168af22c6a6014a
|
4
|
+
data.tar.gz: 6b58d43be522a4f7937c44b42a6e8cb614fc7744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
@@ -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
|
-
|
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
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
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
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
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
|
+
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-
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|