logstash-input-sqs_s3 1.1.9 → 1.1.10

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
  SHA256:
3
- metadata.gz: e7de24022060f4e885e322603abf41c4fbc877afced19d842c90980e629d79f8
4
- data.tar.gz: 1f070ee138eb056954419000b48158eacdc71c0420eb5ecf414fa0f982783af5
3
+ metadata.gz: 401697fc19ae1f091396735b9fda10659d924359dcb055037c056f3dd3f21026
4
+ data.tar.gz: 1f58ee79c752ce0afabc25707db169ccd373703df2db48965fc425aa6eb70158
5
5
  SHA512:
6
- metadata.gz: bc28c03327db1cf531666f51873b24550a9b394ee7955703510729b282e451c7763e5083228e256fe9e8a526d985dcd77cb9d9eb91f78f59bf4dcdb7a88cd202
7
- data.tar.gz: 414350b8a4ec1b3f7822dd0e5157b4d175d987c00eba884db588662fcf2db806c0961839a830f5dbc31cb33cfb0d80c186f46252ecbbeb53d93d01c1bbbede63
6
+ metadata.gz: 9426be0fce6d9b646d7546e9a7012cf997f81e253b173424dbc7936970cd395af1fb56e397b5961fa9f42b1182607408a94601a02a82089798fce25fc46a5fe6
7
+ data.tar.gz: 8f82ff8157575de0607b2e2bfb592cbe2d95452be324e159b73f098f2ec2cf07e600d588e22c0bf7a78b2f06a460c83a0e6d78a3454aa67236ad284fa35a9207
@@ -1,3 +1,6 @@
1
+ ## 1.1.10
2
+ - Added throttle capability to slow down processing based on file size
3
+
1
4
  ## 1.1.9
2
5
  - Added metadata keys to the event
3
6
 
@@ -110,9 +110,15 @@ class LogStash::Inputs::SQSS3 < LogStash::Inputs::Threadable
110
110
  # Max messages to fetch, default is 10
111
111
  config :max_messages_to_fetch, :validate => :number, :default => MAX_MESSAGES_TO_FETCH
112
112
 
113
- #If set to true, does NOT delete the message after polling
113
+ # If set to true, does NOT delete the message after polling
114
114
  config :skip_delete, :validate => :string, :default => SKIP_DELETE
115
115
 
116
+ # This is the max current load to support before throttling back (in Bytes)
117
+ config :max_load_before_throttling, :validate => :number, :default => 300000000
118
+
119
+ # Number of seconds to throttle back once max load has been met
120
+ config :seconds_to_throttle, :validate => :number, :default => 15
121
+
116
122
  attr_reader :poller
117
123
  attr_reader :s3
118
124
 
@@ -120,6 +126,7 @@ class LogStash::Inputs::SQSS3 < LogStash::Inputs::Threadable
120
126
  require "aws-sdk"
121
127
  @logger.info("Registering SQS input", :queue => @queue)
122
128
  @logger.info("Skip Delete", :skip_delete => @skip_delete)
129
+ @current_load = 0.0
123
130
  setup_queue
124
131
  end
125
132
 
@@ -181,6 +188,9 @@ class LogStash::Inputs::SQSS3 < LogStash::Inputs::Threadable
181
188
  end
182
189
  # process the plain text content
183
190
  begin
191
+ # assess currently running load (in MB)
192
+ @current_load += (record['s3']['object']['size'].to_f / 1000000)
193
+
184
194
  lines = body.read.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: "\u2370").split(/\n/)
185
195
  lines.each do |line|
186
196
  @codec.decode(line) do |event|
@@ -225,6 +235,25 @@ class LogStash::Inputs::SQSS3 < LogStash::Inputs::Threadable
225
235
  # this can take up to "Receive Message Wait Time" (of the sqs queue) seconds to be recognized
226
236
  throw :stop_polling
227
237
  end
238
+
239
+ # Throttle requests is overloaded by big files
240
+ if @current_load > @max_load_before_throttling/1000000 then
241
+ @logger.warn("**********Current load has exceeded " + (@max_load_before_throttling.to_f/1000000).to_s + " MB. Load is currently: " + @current_load.to_s + ". Throttling back by " + (@seconds_$
242
+
243
+ throttle_seconds_sleep = @seconds_to_throttle * (@current_load / (@max_load_before_throttling.to_f/1000000)).floor
244
+
245
+ if(throttle_seconds_sleep != 0) then
246
+ sleep(throttle_seconds_sleep)
247
+ end
248
+
249
+ # Cap the throttle time to 2 min
250
+ if(throttle_seconds_sleep > 120) then
251
+ sleep(120)
252
+ end
253
+ end
254
+
255
+ # Reset load to 0
256
+ @current_load = 0.0
228
257
  end
229
258
  # poll a message and process it
230
259
  run_with_backoff do
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-sqs_s3'
3
- s.version = '1.1.9'
3
+ s.version = '1.1.10'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Get logs from AWS s3 buckets as issued by an object-created event via sqs."
6
6
  s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program. Full credit goes to Heiko Finzel. Republishing this gem to support Logstash 5."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-sqs_s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heiko Finzel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-09 00:00:00.000000000 Z
11
+ date: 2017-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement