Skip to content
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

Exception when pattern file is not readable #33

Open
TheVastyDeep opened this issue Feb 9, 2022 · 0 comments
Open

Exception when pattern file is not readable #33

TheVastyDeep opened this issue Feb 9, 2022 · 0 comments

Comments

@TheVastyDeep
Copy link

Logstash 8.0.0.rc2 with bundled JVM. The add_patterns_from_file function in grok_pure.rb calls file.close in the ensure branch, even if File.new returns nil. This leads to

:exception=>#<NoMethodError: undefined method close' for nil:NilClass>, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/jls-grok-0.11.5/lib/grok-pure.rb:83:in add_patterns_from_file'"`

To reproduce

cd /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-patterns-core-4.3.2/patterns/ecs-v1
touch zzz
chmod 0 zzz

and run logstash with

input { generator { count => 1 lines => [ '' ] } }
filter { grok { match => { "message" => "%{NUMBER:foo}" } } }
output { stdout { codec => rubydebug { metadata => false } } }

Silently ignoring the unreadable file would be an improvement, but not ideal.

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

1 participant