我无法在我的机器上启动logstash。里面有错误信息

时间:2017-06-10 00:33:57

标签: elasticsearch logstash logstash-configuration

以下是教程中的测试命令:

<object data="{{document}}" type="application/pdf" style="width:100%; height:400px" />

以下是错误。

./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
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)'"]}

该目录由logstash拥有和写入。

有人可以建议任何解决方案吗?

4 个答案:

答案 0 :(得分:1)

您必须在sudo模式下启动logstash。那是

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

答案 1 :(得分:0)

异常消息告诉您logstash找不到configure属性,因此您应该在命令中添加一个标志来告诉logstash configure属性。另一个例外是logstash无法写入/ usr / share / logstash / data,您应该使用'sudo'来启动此命令,或者您可以将/ usr / share / logstash / data的写入权限添加到您的帐户。

logstash版本:5.5.2

os版本:ubuntu 16.04

启动logstash作为流程的命令:

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

ps:我通过apt install the document of install logstash

安装logstash

答案 2 :(得分:0)

您打算以logstash用户身份运行它,而不是root或任何其他用户 - 这就是logstash用户拥有它的原因。因此,请改用以下内容:

sudo -Hu logstash /usr/share/logstash/bin/logstash -e 'input { stdin { } } output { stdout {} }'

此处的主要部分是以logstash用户身份运行您的命令:

sudo -Hu logstash <command you want to run>

答案 3 :(得分:0)

您可以创建logstash-data目录,并使用--path.data logstash-data将当前目录中的logstash-data用作logstash数据目录。