Logstash HTTP input plugin configuration error: Expected one of #

Logstash HTTP input plugin configuration error: Expected one of #

我正在尝试按照官方 documentation 配置 logstash HTTP 输入插件。我将以下配置保存在 10-syslog.conf

input {
   port => 8080
   user => elkadmin
   password => "xxxx"
   ssl => off
}
output {
  elasticsearch {
    host => "127.0.0.1"
   codec => "json"
    index => "logstash-%{+YYYY.MM.dd}"
    protocol => "http"
  }
  stdout { codec => rubydebug }
}

Logstash 在使用以下命令时确实启动成功:

sudo service logstash restart

我运行使用

对输入插件的配置文件进行了配置检查

/opt/logstash/bin/logstash -configtest -f 10-syslog.conf

配置检查返回以下错误:

Error: Expected one of #, { at line 2, column 9 (byte 18) after input {

查看logstash日志我发现可能是权限问题:

{:timestamp=>"2016-10-16T20:41:30.900000+0000", :message=>"The error reported is: \n Permission denied - /etc/logstash/conf.d/10-syslog.conf"}

我非常不确定如何在这里进行,任何帮助 and/or 指导将不胜感激。

您只是在输入部分遗漏了 http 输入插件的名称(错字来自您 link 阅读的博客文章)

input {
  http {                   <--- add this
    port => 8080
    user => elkadmin
    password => "xxxx"
    ssl => off
  }
}

另请注意,在您的 elasticsearch 输出插件中,host 应显示为 hosts,并且不再支持 protocol

你的 link 是旧的(从 2015 年开始),你最好使用 https://www.elastic.co/guide/en/logstash/current/plugins-inputs-http.html

上的最新文档