logstash-input-s3-sns-sqs 1.5.7 → 1.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/lib/logstash/inputs/s3snssqs.rb +8 -6
- data/logstash-input-s3-sns-sqs.gemspec +1 -1
- 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: 6860348c004b9f2f4f0a24ab9f739badbb446602
|
4
|
+
data.tar.gz: a25b584d5aecc768350619acd373dd7a9d664002
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ec9528870b236cbc751f832cb8d651836a9dae94a52df7bff2e5cf88c48f92eb809f9f407018d414021f5394f583c275452746d9d1d76af7a436707362b8088
|
7
|
+
data.tar.gz: 2288cefe92f76f3de97855b9b258e88def3427f4a60164395824e09d27fbf2d6376fbce1aeecdfddab5d52c6884f9d3bfb5a22dca8f37f0ae52b6ee5822647b4
|
data/CHANGELOG.md
CHANGED
@@ -111,6 +111,7 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
111
111
|
#set_codec_by_folder => {"My-ELB-logs" => "plain"}
|
112
112
|
config :set_codec_by_folder, :validate => :hash, :default => {}
|
113
113
|
config :delete_on_success, :validate => :boolean, :default => false
|
114
|
+
config :sqs_explicit_delete, :validate => :boolean, :default => false
|
114
115
|
# Whether the event is processed though an SNS to SQS. (S3>SNS>SQS = true |S3>SQS=false)
|
115
116
|
config :from_sns, :validate => :boolean, :default => true
|
116
117
|
# To run in multiple threads use this
|
@@ -198,12 +199,13 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
198
199
|
@logger.debug("It is a valid record")
|
199
200
|
bucket = CGI.unescape(record['s3']['bucket']['name'])
|
200
201
|
key = CGI.unescape(record['s3']['object']['key'])
|
202
|
+
size = record['s3']['object']['size']
|
201
203
|
type_folder = get_object_folder(key)
|
202
204
|
# Set input codec by :set_codec_by_folder
|
203
205
|
instance_codec = set_codec(type_folder) unless set_codec_by_folder["#{type_folder}"].nil?
|
204
206
|
# try download and :skip_delete if it fails
|
205
207
|
#if record['s3']['object']['size'] < 10000000 then
|
206
|
-
process_log(bucket, key, type_folder, instance_codec, queue, message)
|
208
|
+
process_log(bucket, key, type_folder, instance_codec, queue, message, size)
|
207
209
|
#else
|
208
210
|
# @logger.info("Your file is too big")
|
209
211
|
#end
|
@@ -213,13 +215,13 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
213
215
|
end
|
214
216
|
|
215
217
|
private
|
216
|
-
def process_log(bucket , key, folder, instance_codec, queue, message)
|
218
|
+
def process_log(bucket , key, folder, instance_codec, queue, message, size)
|
217
219
|
s3bucket = @s3_resource.bucket(bucket)
|
218
220
|
@logger.debug("Lets go reading file", :bucket => bucket, :key => key)
|
219
221
|
object = s3bucket.object(key)
|
220
222
|
filename = File.join(temporary_directory, File.basename(key))
|
221
223
|
if download_remote_file(object, filename)
|
222
|
-
if process_local_log( filename, key, folder, instance_codec, queue, bucket, message)
|
224
|
+
if process_local_log( filename, key, folder, instance_codec, queue, bucket, message, size)
|
223
225
|
begin
|
224
226
|
FileUtils.remove_entry_secure(filename, true)
|
225
227
|
delete_file_from_bucket(object)
|
@@ -266,7 +268,7 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
266
268
|
# @param [Queue] Where to push the event
|
267
269
|
# @param [String] Which file to read from
|
268
270
|
# @return [Boolean] True if the file was completely read, false otherwise.
|
269
|
-
def process_local_log(filename, key, folder, instance_codec, queue, bucket, message)
|
271
|
+
def process_local_log(filename, key, folder, instance_codec, queue, bucket, message, size)
|
270
272
|
@logger.debug('Processing file', :filename => filename)
|
271
273
|
metadata = {}
|
272
274
|
start_time = Time.now
|
@@ -275,7 +277,7 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
275
277
|
# input and send as bytes to the codecs.
|
276
278
|
read_file(filename) do |line|
|
277
279
|
if (Time.now - start_time) >= (@visibility_timeout.to_f / 100.0 * 90.to_f)
|
278
|
-
@logger.info("Increasing the visibility_timeout ... ", :timeout => @visibility_timeout, :filename => filename )
|
280
|
+
@logger.info("Increasing the visibility_timeout ... ", :timeout => @visibility_timeout, :filename => filename, :filesize => size, :start => start_time )
|
279
281
|
poller.change_message_visibility_timeout(message, @visibility_timeout)
|
280
282
|
start_time = Time.now
|
281
283
|
end
|
@@ -512,7 +514,7 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
512
514
|
poller.poll(polling_options) do |message|
|
513
515
|
begin
|
514
516
|
handle_message(message, queue, @codec.clone)
|
515
|
-
poller.delete_message(message)
|
517
|
+
poller.delete_message(message) if @sqs_explicit_delete
|
516
518
|
rescue Exception => e
|
517
519
|
@logger.info("Error in poller block ... ", :error => e)
|
518
520
|
end
|
@@ -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.
|
3
|
+
s.version = '1.5.8'
|
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.
|
4
|
+
version: 1.5.8
|
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-05-
|
11
|
+
date: 2018-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|