未知设置'主机'对于弹性搜索

时间:2016-08-22 14:31:12

标签: elasticsearch exec logstash

我试图在我的Mac上运行logstash配置文件,但每次我这样做,都会收到此错误:

 'Unknown setting 'hosts' for elasticsearch {:level=>:error} 
  Error: Something is wrong with your configuration.
  You may be interested in the '--configtest' flag which you can
  use to validate logstash's configuration before you choose
  to restart a running system.'

我正在检索JIRA数据并将其发送到elasticsearch,但即使这个简单的任务也会返回错误。这是我的代码:

 input{
        exec {
             command => "curl -u username:password https://mycompany.atlassian.net/rest/api/latest/search?maxResults=10"
              interval => 300
               }
       }
  output{
       elasticsearch{
             hosts => ["127.0.0.1:9200"]
             index => "test"
        }
   }  

2 个答案:

答案 0 :(得分:8)

您可能正在使用旧版本的Logstash(2.0之前版本),只需重命名hosts to host,您就可以了:

   output{
       elasticsearch{
             host => ["127.0.0.1:9200"]
             index => "test"
        }
   }  

答案 1 :(得分:0)

感谢Val的信息!我发现我的mac上有多个logstash目录,它使用的是旧版本(1.x)而不是2.3。我刚刚删除了旧目录,代码工作正常!