Error on Running Logstash

When I run the following command
bin/logstash -f /etc/logstash/logstash-sample.conf .
I get the following error

runner - An unexpected error occurred! {:error=>java.nio.file.AccessDeniedException: /usr/share/logstash/data/.lock, :backtrace=>["sun.nio.fs.UnixException.translateToIOException(sun/nio/fs/UnixException.java:90)", "sun.nio.fs.UnixException.rethrowAsIOException(sun/nio/fs/UnixException.java:111)", "sun.nio.fs.UnixException.rethrowAsIOException(sun/nio/fs/UnixException.java:116)", "sun.nio.fs.UnixFileSystemProvider.newFileChannel(sun/nio/fs/UnixFileSystemProvider.java:182)", "java.nio.channels.FileChannel.open(java/nio/channels/FileChannel.java:292)", "java.nio.channels.FileChannel.open(java/nio/channels/FileChannel.java:345)", "org.logstash.FileLockFactory.obtainLock(org/logstash/FileLockFactory.java:89)", "jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)", "jdk.internal.reflect.NativeMethodAccessorImpl.invoke(jdk/internal/reflect/NativeMethodAccessorImpl.java:62)", "jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:566)", "org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:471)", "org.jruby.javasupport.JavaMethod.invokeStaticDirect(org/jruby/javasupport/JavaMethod.java:373)", "RUBY.execute(/usr/share/logstash/logstash-core/lib/logstash/runner.rb:406)", "usr.share.logstash.vendor.bundle.jruby.$2_dot_5_dot_0.gems.clamp_minus_1_dot_0_dot_1.lib.clamp.command.run(/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/clamp-1.0.1/lib/clamp/command.rb:68)", "usr.share.logstash.logstash_minus_core.lib.logstash.runner.run(/usr/share/logstash/logstash-core/lib/logstash/runner.rb:290)", "usr.share.logstash.vendor.bundle.jruby.$2_dot_5_dot_0.gems.clamp_minus_1_dot_0_dot_1.lib.clamp.command.run(/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/clamp-1.0.1/lib/clamp/command.rb:133)", "usr.share.logstash.lib.bootstrap.environment.(/usr/share/logstash/lib/bootstrap/environment.rb:93)", "java.lang.invoke.MethodHandle.invokeWithArguments(java/lang/invoke/MethodHandle.java:710)", "org.jruby.Ruby.runScript(org/jruby/Ruby.java:1205)", "org.jruby.Ruby.runNormally(org/jruby/Ruby.java:1128)", "org.jruby.Ruby.runNormally(org/jruby/Ruby.java:1146)", "org.jruby.Ruby.runFromMain(org/jruby/Ruby.java:958)", "org.logstash.Logstash.run(org/logstash/Logstash.java:161)", "org.logstash.Logstash.main(org/logstash/Logstash.java:71)"]}
[FATAL] 2023-01-31 20:05:26.507 [LogStash::Runner] Logstash - Logstash stopped processing because of an error: (SystemExit) exit
org.jruby.exceptions.SystemExit: (SystemExit) exit
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:747) ~[jruby-complete-9.2.20.1.jar:?]
at org.jruby.RubyKernel.exit(org/jruby/RubyKernel.java:710) ~[jruby-complete-9.2.20.1.jar:?]
at usr.share.logstash.lib.bootstrap.environment.(/usr/share/logstash/lib/bootstrap/environment.rb:94) ~[?:?]

My logstash-sample.conf file looks like this

Sample Logstash configuration for creating a simple

Beats -> Logstash -> Elasticsearch pipeline.

input {
beats {
port => 5044
}
}

filter{

  if "iperftcp" in [tags]{
csv {
separator => ","
columns => ["Timestamp","TestCase","Iteration","duration","local_cpu_total","remote_cpu_total","Protocol","tcp_mss_default","retransmits","sent_bytes","sent_bps","sent_kbps","sent_Mbps","sent_kB_s","sent_MB_s","received_bytes","received_bps","received_kbps","received_Mbps","received_kB_s","received_MB_s","Error"]

    }

}

  if "iperfudp" in [tags]{
csv {
separator => ","
columns => ["Timestamp","TestCase","Iteration","duration","local_cpu_total","remote_cpu_total","Protocol","bytes","bps","jitter_ms","kbps","Mbps","kB_s","MB_s","packets","lost_packets","lost_percent","seconds","Error"]
    }

}

date {
match => [ "Timestamp", "EEE MMM d HH:mm:ss yyyy" ]
     }

if "_csvparsefailure" in [tags] {
drop { } }
if "_dateparsefailure" in [tags] {
drop { } }

}

output {

if "iperftcp" in [tags]
{
elasticsearch
{
hosts=>"localhost:9200"
index=>"trialiperftcp"
}
}
if "iperfudp" in [tags]
{
elasticsearch
{
hosts=>"localhost:9200"
index=>"trialiperfudp"
}
}

}

Hi Meghana,

You're getting an access denied exception, so there's most likely an issue with file permissions. I'm guessing it's the config file logstash-sample.conf.

Can you check and update the permissions of your config file and make sure it's readable before rerunning the command?

Please rename /usr/share/logstash/data/.lock

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.