logstash-input-s3-sns-sqs 1.5.1 → 1.5.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: 7875b26fc8690113c70bcc284b20cec63cc107e0
4
- data.tar.gz: 6aab357d02c54d506f0947bb558014d292e3337d
3
+ metadata.gz: 551338b8aa2fab2c80ffe77647e9b5b23f325ceb
4
+ data.tar.gz: d47bfd42d5d4be0755ebac6cc584791a817412a1
5
5
  SHA512:
6
- metadata.gz: 2d352324eb05b87c4f4f9c83d7465d210bc5dbc9f350f1f6a7a0a13e42b36e733a5d58e9c6325af319b8549a5a4d1ffb0d4c58d26225093bea52124412f58c7c
7
- data.tar.gz: 2d15886020d6aba12e6ff49acd196f40f865f06d7a83e5d231628b1953cd68679a7e5e427508a75cc9898c4078f79c0ff3d7043606bf6ff07fdb2d29449078eb
6
+ metadata.gz: ba84a290bfd425ef85b4096178013db7c12d6e9796fccef617655f7e8d030d7f32a151d32dab4cb1fc898aa2ff3ec03a68c5e13d2d5d6d6b08323cd30192fbc9
7
+ data.tar.gz: b30d9286f67efd2efc329796b60ae4cf7899c3edbfa6848d9c7e19997d54c99d2c89c1cef6e555bcbc78590f64af7275a93598d28c13fefae12687fb3776c142
@@ -1,3 +1,6 @@
1
+ ## 1.5.2
2
+ - BugFix Set Metadata bucket,key,folder
3
+ - Feature: Possibility to fall back to old threadding model by unset consumer_threads
1
4
  ## 1.5.1
2
5
  - BugFix: rescue all AWS::S3 errors
3
6
  ## 1.5.0
@@ -113,7 +113,7 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
113
113
  # Whether the event is processed though an SNS to SQS. (S3>SNS>SQS = true |S3>SQS=false)
114
114
  config :from_sns, :validate => :boolean, :default => true
115
115
  # To run in multiple threads use this
116
- config :consumer_threads, :validate => :number, :default => 1
116
+ config :consumer_threads, :validate => :number
117
117
  config :temporary_directory, :validate => :string, :default => File.join(Dir.tmpdir, "logstash")
118
118
  # The AWS IAM Role to assume, if any.
119
119
  # This is used to generate temporary credentials typically for cross-account access.
@@ -305,10 +305,10 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
305
305
  event.set("cloudfront_version", metadata[:cloudfront_version]) unless metadata[:cloudfront_version].nil?
306
306
  event.set("cloudfront_fields", metadata[:cloudfront_fields]) unless metadata[:cloudfront_fields].nil?
307
307
 
308
- event.set("[@metadata][s3]", { "object_key" => key })
309
- event.set("[@metadata][s3]", { "bucket_name" => bucket })
310
- event.set("[@metadata][s3]", { "object_folder" => folder})
311
- #@logger.debug('queuing event', :event => event.to_s)
308
+ event.set("[@metadata][s3][object_key]", key)
309
+ event.set("[@metadata][s3][bucket_name]", bucket)
310
+ event.set("[@metadata][s3][object_folder]", folder)
311
+ @logger.debug('add metadata', :object_key => key, :bucket => bucket, :folder => folder)
312
312
  queue << event
313
313
  end
314
314
  end
@@ -432,21 +432,43 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
432
432
 
433
433
  public
434
434
  def run(queue)
435
- # ensure we can stop logstash correctly
436
- @runner_threads = consumer_threads.times.map { |consumer| thread_runner(queue) }
437
- @runner_threads.each { |t| t.join }
435
+ if @consumer_threads
436
+ # ensure we can stop logstash correctly
437
+ @runner_threads = consumer_threads.times.map { |consumer| thread_runner(queue) }
438
+ @runner_threads.each { |t| t.join }
439
+ else
440
+ #Fallback to simple single thread worker
441
+ # ensure we can stop logstash correctly
442
+ poller.before_request do |stats|
443
+ if stop? then
444
+ @logger.warn("issuing :stop_polling on stop?", :queue => @queue)
445
+ # this can take up to "Receive Message Wait Time" (of the sqs queue) seconds to be recognized
446
+ throw :stop_polling
447
+ end
448
+ end
449
+ # poll a message and process it
450
+ run_with_backoff do
451
+ poller.poll(polling_options) do |message|
452
+ handle_message(message, queue, @codec.clone)
453
+ end
454
+ end
455
+ end
438
456
  end
439
457
 
440
458
  public
441
459
  def stop
442
- @runner_threads.each do |c|
443
- begin
444
- @logger.info("Stopping thread ... ", :thread => c.inspect)
445
- c.wakeup
446
- rescue
447
- @logger.error("Cannot stop thread ... try to kill him", :thread => c.inspect)
448
- c.kill
460
+ if @consumer_threads
461
+ @runner_threads.each do |c|
462
+ begin
463
+ @logger.info("Stopping thread ... ", :thread => c.inspect)
464
+ c.wakeup
465
+ rescue
466
+ @logger.error("Cannot stop thread ... try to kill him", :thread => c.inspect)
467
+ c.kill
468
+ end
449
469
  end
470
+ else
471
+ @logger.warn("Stopping all threads?", :queue => @queue)
450
472
  end
451
473
  end
452
474
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-s3-sns-sqs'
3
- s.version = '1.5.1'
3
+ s.version = '1.5.2'
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 sns -> 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"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-s3-sns-sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Herweg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-11 00:00:00.000000000 Z
11
+ date: 2018-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement