2016-08-22 33 views
2

我想在我的Mac上運行logstash配置文件,但每次我這樣做,我得到這個錯誤:未知設置「託管」的elasticsearch

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

回答

5

你可能使用的是舊版本Logstash的(預2.0),只需重命名hosts to host,你會被罰款:

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

幫助我也是,在我的情況下,我使用的是更新的版本,但是遵循基於舊版本的教程。將主機更改爲主機,並且效果很好。 :) –

0

感謝瓦爾的信息!我發現我的Mac上有多個logstash目錄,它使用的是舊版本(1.x)而不是2.3。我剛剛刪除了舊的目錄,並且代碼正常工作!