logstash-input-s3-sns-sqs 1.5.5 → 1.5.6
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 +17 -19
- data/logstash-input-s3-sns-sqs.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2844e9d4b19c4f7e8cf3bf176364eedc803bd5d4
|
4
|
+
data.tar.gz: 38ef08235d941ca58243c3cea8d26371b3259590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88f97f97d2ff100ca317630bdb3ff1c1420a82457b1ab68deb488e0d73de01d338991f360d1a566b2ed42fa37e2d68ce931cbfaf63ebf244865e3a7cf1729527
|
7
|
+
data.tar.gz: 3663bf7c764de71b5dbf86fc587c3678cdc7dc50e1b74e2fe53846c4fea415b69008fea2f8388cbd94e2a63491fa39e77e7c4d27380e54cef6a106ccd9828bcb
|
data/CHANGELOG.md
CHANGED
@@ -203,7 +203,7 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
203
203
|
instance_codec = set_codec(type_folder) unless set_codec_by_folder["#{type_folder}"].nil?
|
204
204
|
# try download and :skip_delete if it fails
|
205
205
|
#if record['s3']['object']['size'] < 10000000 then
|
206
|
-
process_log(bucket, key, type_folder, instance_codec, queue)
|
206
|
+
process_log(bucket, key, type_folder, instance_codec, queue, message)
|
207
207
|
#else
|
208
208
|
# @logger.info("Your file is too big")
|
209
209
|
#end
|
@@ -213,13 +213,13 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
213
213
|
end
|
214
214
|
|
215
215
|
private
|
216
|
-
def process_log(bucket , key, folder, instance_codec, queue)
|
216
|
+
def process_log(bucket , key, folder, instance_codec, queue, message)
|
217
217
|
s3bucket = @s3_resource.bucket(bucket)
|
218
218
|
@logger.debug("Lets go reading file", :bucket => bucket, :key => key)
|
219
219
|
object = s3bucket.object(key)
|
220
220
|
filename = File.join(temporary_directory, File.basename(key))
|
221
221
|
if download_remote_file(object, filename)
|
222
|
-
if process_local_log( filename, key, folder, instance_codec, queue, bucket)
|
222
|
+
if process_local_log( filename, key, folder, instance_codec, queue, bucket, message)
|
223
223
|
begin
|
224
224
|
FileUtils.remove_entry_secure(filename, true)
|
225
225
|
delete_file_from_bucket(object)
|
@@ -228,11 +228,11 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
228
228
|
end
|
229
229
|
end
|
230
230
|
else
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
231
|
+
begin
|
232
|
+
FileUtils.remove_entry_secure(filename, true)
|
233
|
+
rescue Exception => e
|
234
|
+
@logger.debug("We had problems clean up your tmp dir", :file => filename, :error => e)
|
235
|
+
end
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
@@ -266,18 +266,24 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
266
266
|
# @param [Queue] Where to push the event
|
267
267
|
# @param [String] Which file to read from
|
268
268
|
# @return [Boolean] True if the file was completely read, false otherwise.
|
269
|
-
def process_local_log(filename, key, folder, instance_codec, queue, bucket)
|
270
|
-
@logger.
|
269
|
+
def process_local_log(filename, key, folder, instance_codec, queue, bucket, message)
|
270
|
+
@logger.info('Processing file', :filename => filename)
|
271
271
|
metadata = {}
|
272
|
+
start_time = Time.now
|
272
273
|
# Currently codecs operates on bytes instead of stream.
|
273
274
|
# So all IO stuff: decompression, reading need to be done in the actual
|
274
275
|
# input and send as bytes to the codecs.
|
275
276
|
read_file(filename) do |line|
|
277
|
+
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 )
|
279
|
+
poller.change_message_visibility_timeout(message, @visibility_timeout)
|
280
|
+
start_time = Time.now
|
281
|
+
end
|
276
282
|
if stop?
|
277
283
|
@logger.warn("Logstash S3 input, stop reading in the middle of the file, we will read it again when logstash is started")
|
278
284
|
return false
|
279
285
|
end
|
280
|
-
|
286
|
+
line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: "\u2370")
|
281
287
|
#@logger.debug("read line", :line => line)
|
282
288
|
instance_codec.decode(line) do |event|
|
283
289
|
@logger.debug("decorate event")
|
@@ -462,10 +468,6 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
462
468
|
run_with_backoff do
|
463
469
|
poller.poll(polling_options) do |message|
|
464
470
|
begin
|
465
|
-
Stud.interval(@visibility_timeout - 10 ) do
|
466
|
-
@logger.info("Increasing the visibility_timeout ... ")
|
467
|
-
poller.change_message_visibility_timeout(message, 60)
|
468
|
-
end
|
469
471
|
handle_message(message, queue, @codec.clone)
|
470
472
|
poller.delete_message(message)
|
471
473
|
rescue Exception => e
|
@@ -509,10 +511,6 @@ class LogStash::Inputs::S3SNSSQS < LogStash::Inputs::Threadable
|
|
509
511
|
run_with_backoff do
|
510
512
|
poller.poll(polling_options) do |message|
|
511
513
|
begin
|
512
|
-
Stud.interval(@visibility_timeout - 10 ) do
|
513
|
-
@logger.info("Increasing the visibility_timeout ... ")
|
514
|
-
poller.change_message_visibility_timeout(msg, 60)
|
515
|
-
end
|
516
514
|
handle_message(message, queue, @codec.clone)
|
517
515
|
poller.delete_message(message)
|
518
516
|
rescue Exception => e
|
@@ -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.6'
|
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"
|