Recently upgraded Logstash (which was installed via Homebrew) on macOS Mojave (10.14.4) to version 6.7.0 and things are not working as expected. When I try to run it manually via the command line—for local development purposes—I consistently get this error:
Error: Permission denied - Permission denied
Exception: Errno::EACCES
Stack: org/jruby/RubyFile.java:1263:in `utime'
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/fileutils.rb:1133:in `block in touch'
What’s maddening is when the same exact Logstash config files are used on the RedHat 7 production server where I have Logstash 6.7.0 installed as system service—via the official Elastic repos—everything works as expected.
My input config file looks like this:
input {
file {
path => "/opt/logstash/coolapp/access_log*"
exclude => "*.gz"
start_position => "beginning"
sincedb_path => "/dev/null"
close_older => "1 hour"
stat_interval => "1 second"
discover_interval => 15
}
}
This stuff is fairly simple as far as a config goes and all my settings match valid/accepted settings according to the official Logstash reference manual. But if I comment out the sincedb_path => "/dev/null"
line, my Logstash setup on macOS works as expected.
What the heck is happening to cause this issue? I mean I can be aware of commenting out sincedb_path => "/dev/null"
when I do local development work, but still… This is really annoying.
Okay, I figured this out… In a way. The issue is obliquely referred to in the error line:
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/fileutils.rb:1133:in `block in touch'
And the only temporary solution I have found is to comment out this line in my config:
sincedb_path => "/dev/null"
It seems that the production server I have running Logstash is using JRuby version 2.5.x and my local macOS version installed via Homebrew is using jRuby version 2.4.x. And apparently fileutils.rb
in JRuby 2.4.x handles touch
in cases for non-existent devices (such as /dev/null
) differently than JRuby 2.5.x. And thus, Logstash fails on my macOS development setup.
So it seems this was all a Homebrew (or macOS?) issue rather than a Logstash issue.