Skip to content

File exclude behavior changed in undocumented ways #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sysadmin1139 opened this issue May 11, 2019 · 2 comments
Closed

File exclude behavior changed in undocumented ways #237

sysadmin1139 opened this issue May 11, 2019 · 2 comments

Comments

@sysadmin1139
Copy link

After doing an upgrade from logstash 2.4 to logstash 6.7.2 (this was a long time coming) we observed a difference in behavior of how the exclude feature behaves.

input {
  file {
    path => '/var/lib/example/log/*.log'
    exclude => [
      'unfortunate-secrets.log',
      'uselessly-noisy.log'
    ]
    type => 'app_example'
  }
}

This fragment worked to exclude the unfortunate-secrets file in Logstash 2.4, and many earlier versions as well. Not anymore. The new behavior has both of the excluded files included in the pipeline. As a workaround we added a filter {} stage to drop {} anything with path == '/var/lib/example/log/unfortunate-secrets.log' which works.

The documentation surrounding the path attribute hasn't changed. The documentation for exclude includes a mention of Tail mode but is otherwise unchanged between the versions.

This is running on Ubuntu 16.04 with Java8.

@ddaanet
Copy link
Contributor

ddaanet commented Jan 3, 2020

Hi buddy. I have the same issue, and it's been driving me nuts the whole day.

Documentation says: Exclusions (matched against the filename, not full path). Filename patterns are valid here, too.

But the current (7.5.1) code (in filewatch/discoverer.rb/FileWatch.Discoverer.can_exclude?)matches against the full pathname. I am a complete newbie here, so I have no idea what are the hoops to get a bugfix merged, but I'll open a PR anyway.

@jsvd
Copy link
Member

jsvd commented Jan 6, 2020

@jsvd jsvd closed this as completed Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants