elasticsearch 的未知设置 'hosts'

Unknown setting 'hosts' for elasticsearch

我正在尝试 运行 我的 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,但即使是这个简单的任务 returns 也会出错。这是我的代码:

 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"
        }
   }  

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

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

感谢瓦尔提供的信息!我发现我的 mac 上有多个 logstash 目录,并且它使用的是旧版本 (1.x) 而不是 2.3。我刚刚删除了旧目录并且代码有效!