From f4082786a78b8d62e9445dcdaae16115b1273739 Mon Sep 17 00:00:00 2001 From: David Allouche Date: Fri, 3 Jan 2020 23:52:16 +0100 Subject: [PATCH 1/2] discoverer.rb: Exclude patterns match filename The documentation says: Exclusions (matched against the filename, not full path). Filename patterns are valid here, too. https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html#plugins-inputs-file-exclude Fix can_exclude? method so it matches the filename and not the full pathname. --- lib/filewatch/discoverer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/filewatch/discoverer.rb b/lib/filewatch/discoverer.rb index c101559..0b9d889 100644 --- a/lib/filewatch/discoverer.rb +++ b/lib/filewatch/discoverer.rb @@ -35,7 +35,7 @@ def discover def can_exclude?(watched_file, new_discovery) @exclude.each do |pattern| - if watched_file.pathname.fnmatch?(pattern) + if watched_file.pathname.basename.fnmatch?(pattern) if new_discovery logger.trace("Discoverer can_exclude?: #{watched_file.path}: skipping " + "because it matches exclude #{pattern}") From 75edbbcc2f87c2630eabd33c3d806b721ed53fbc Mon Sep 17 00:00:00 2001 From: David Allouche Date: Mon, 6 Jan 2020 16:53:29 +0100 Subject: [PATCH 2/2] CHANGELOG, gemspec: Bump to 4.1.12 (fix regression in exclude) --- CHANGELOG.md | 4 ++++ logstash-input-file.gemspec | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b1b82e..075cb21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.1.12 + - Fix regression in `exclude` handling. Patterns are matched against the filename, not full path. + [Issue #237](https://github.com/logstash-plugins/logstash-input-file/issues/237) + ## 4.1.11 - Fixed link to FAQ [#247](https://github.com/logstash-plugins/logstash-input-file/pull/247) diff --git a/logstash-input-file.gemspec b/logstash-input-file.gemspec index 24b8312..80742b3 100644 --- a/logstash-input-file.gemspec +++ b/logstash-input-file.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'logstash-input-file' - s.version = '4.1.11' + s.version = '4.1.12' 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"