Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I cannot start logstash on my machine. Error message inside

The following is the test command from the tutorial:

./logstash -e 'input { stdin { } } output { stdout {} }'

The following is the error.

WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path //usr/share/logstash/config/log4j2.properties. Using default config which logs to console
01:55:14.242 [main] FATAL logstash.runner - An unexpected error occurred! {:error=>#<ArgumentError: Path "/usr/share/logstash/data" must be a writable directory. It is not writable.>, :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/settings.rb:433:in `validate'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:216:in `validate_value'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:132:in `validate_all'", "org/jruby/RubyHash.java:1342:in `each'", "/usr/share/logstash/logstash-core/lib/logstash/settings.rb:131:in `validate_all'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:217:in `execute'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/runner.rb:185:in `run'", "/usr/share/logstash/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'", "/usr/share/logstash/lib/bootstrap/environment.rb:71:in `(root)'"]}

As for the error message part that says:

Path "/usr/share/logstash/data" must be a writable directory. It is not writable.

The directory is owned and writable by logstash.

Can anyone suggest any solutions?

like image 976
Mnemosyne Avatar asked Jun 10 '17 00:06

Mnemosyne


People also ask

How do I run logstash in debug mode?

Try adding a stdout output with debug set to true. You should be able to see the entire event object and errors / warnings in your logstash --log or stdout. Hope that helps! debug => true doesn't work any more (tested on v2.

How do I run logstash conf in Windows?

Inside the bin folder, run the elasticsearch. bat file in case of windows or you can do the same using the command prompt and through the terminal. In UNIX, run the Logstash file. We need to specify the input source, output source and optional filters.

How do you check if logstash is installed or not?

The most basic thing to check is the status of the Logstash status: sudo service logstash status.


2 Answers

You have to start logstash in the sudo mode. That is

host@host:~$ sudo su
root@host:/home/host# cd /usr/share/logstash
root@host:/usr/share/logstash# ./bin/logstash -e 'input { stdin { } } output { stdout {} }'
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs to console
16:18:33.959 [[main]-pipeline-manager] INFO  logstash.pipeline - Starting pipeline {"id"=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>1000}
16:18:33.996 [[main]-pipeline-manager] INFO  logstash.pipeline - Pipeline main started
The stdin plugin is now waiting for input:
16:18:34.019 [Api Webserver] INFO  logstash.agent - Successfully started Logstash API endpoint {:port=>9600}
Hello
2017-06-10T15:18:43.457Z host Hello
like image 85
berrytchaks Avatar answered Sep 28 '22 17:09

berrytchaks


the exception message tells you that logstash can't find configure property, so you should add a flag in the command to tell logstash the configure property.and another exception is the logstash can't write something to the /usr/share/logstash/data , you should use 'sudo' to start this command, or you can add the write permission of /usr/share/logstash/data to your account.

logstash version:5.5.2

os version:ubuntu 16.04

the command of starting logstash as flow:

sudo bin/logstash -e 'input { stdin { } } output { stdout {} }' --path.settings=/etc/logstash

ps:I install logstash by apt install the document of install logstash

like image 32
faryang Avatar answered Sep 28 '22 17:09

faryang