logstash-input-file
logstash-input-file copied to clipboard
Logstash 2.3.4 doesn't complains when EACCES (Permission denied) on folder
When using the file{} input, if the path is not accessible from the Logstash user there is no errors / warnings anywhere, the only hint you have is by enabling the debug mode and looking at the glob line which doesn't match anything:
{:timestamp=>"2016-10-12T22:29:48.387000+0000", :message=>"_globbed_files: /opt/app/logs/*.log: glob is: []", :level=>:debug, :file=>"filewatch/watch.rb", :line=>"346", :method=>"_globbed_files"}
I used strace to find the issue:
27686 stat("/opt/app/logs/*.log", 0x7fbe942a7ad0) = -1 EACCES (Permission denied)
At least some warnings / error in the logstash.err could be very useful :)
Tested on Amazon Linux RPM: logstash-2.3.4-1.noarch
moved from https://github.com/elastic/logstash/issues/6040
I just hit this on master. Very frustrating to have no errors or warnings in the log, and yet nothing is being ingested. Is this a difficult thing to fix?
I have some suggestions I think would be easy and really help users on this issue. Looking at the code here; https://github.com/logstash-plugins/logstash-input-file/blob/master/lib/filewatch/discoverer.rb#L60
fileset = Dir.glob(path).select { |f| File.file?(f) }
logger.trace("discover_files", :count => fileset.size)
fileset.each do |file|
Something like;
if (fileset.size == 0) log.warn("no files found, check file permissions, watching for new files")
or something that explicity compares the configured file input to Dir::glob output and logs an error if that file isn't found.
Or even just changing that logger.trace
to logger.info
so people can see the count of files found would help.