Skip to content

Commit

Permalink
Fixed tast nipticks and updated version to 4.1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
andsel committed Mar 31, 2020
1 parent da99da4 commit 94fa3b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 4.1.16
- Introduced new `check_archive_validity` settings to enable gzipped files verification, issue [#261](https://github.com/logstash-plugins/logstash-input-file/issues/261)

## 4.1.15
- Fixed bug in conversion of sincedb_clean_after setting [#257](https://github.com/logstash-plugins/logstash-input-file/pull/257)

Expand Down
13 changes: 6 additions & 7 deletions lib/filewatch/read_mode/handlers/read_zip_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def handle_specifically(watched_file)
key = watched_file.sincedb_key

if @settings.check_archive_validity && corrupted?(watched_file)
#watched_file.listener.deleted
watched_file.unwatch
else
begin
Expand All @@ -38,10 +37,8 @@ def handle_specifically(watched_file)
end
watched_file.listener.eof
rescue ZipException => e
logger.error("Cannot decompress the gzip file at path: #{watched_file.path}", :exception => e,
:class => e.class.name,
:message => e.message,
:backtrace => e.backtrace)
logger.error("Cannot decompress the gzip file at path: #{watched_file.path}", :exception => e.class,
:message => e.message, :backtrace => e.backtrace)
watched_file.listener.error
else
sincedb_collection.store_last_read(key, watched_file.last_stat_size)
Expand All @@ -65,7 +62,8 @@ def close_and_ignore_ioexception(closeable)
begin
closeable.close
rescue Exception => e # IOException can be thrown by any of the Java classes that implement the Closable interface.
logger.warn("Ignoring an IOException when closing an instance of #{closeable.class.name}", "exception" => e)
logger.warn("Ignoring an IOException when closing an instance of #{closeable.class.name}",
:exception => e.class, :message => e.message, :backtrace => e.backtrace)
end
end

Expand All @@ -80,7 +78,8 @@ def corrupted?(watched_file)
return false
rescue ZipException => e
duration = Time.now - start
logger.warn("#{watched_file.path} is corrupted, #{duration} secs, message: #{e.message}")
logger.warn("Detected corrupted archive #{watched_file.path} file won't be processed", :message => e.message,
:duration => duration.round(3))
return true
ensure
close_and_ignore_ioexception(gzip_stream) unless gzip_stream.nil?
Expand Down
2 changes: 1 addition & 1 deletion logstash-input-file.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|

s.name = 'logstash-input-file'
s.version = '4.1.15'
s.version = '4.1.16'
s.licenses = ['Apache-2.0']
s.summary = "Streams events from files"
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
Expand Down

0 comments on commit 94fa3b2

Please sign in to comment.