2017-01-03 182 views
0

我對elasticsearch-kibana-logstash非常陌生,似乎無法找到此解決方案。在不使用kibana的情況下在kibana中創建索引

我試圖創建索引,我將在kibana中看到,而不必在開發工具部分使用POST命令。

我已經設置test.conf-

input { 
file { 
    path => "/home/user/logs/server.log" 
    type => "test-type" 
    start_position => "beginning" 
} 
} 

output { 
elasticsearch { 
    hosts => ["localhost:9200"] 
    index => "new-index" 
} 
} 

然後

從logstash目錄bin/logstash -f test.conf

我所得到的是,我無法找到kibana新指數(指數模式部分),當我使用elasticsearch - http://localhost:9200/new-index/它提出了一個錯誤,當我去http://localhost:9600/(它顯示的端口)它似乎沒有任何錯誤

非常感謝您的幫助!

+0

你的意思是你在'http:// localhost:9200'的索引列表中找不到你正在試圖使用'logstash'創建的'new-index'? – Kulasangar

+0

在kibana中找不到它..難道不是假設去那裏...? – Dardar1991

+0

我也嘗試設置'hosts => [「http:// localhost:5601 /」]'(kibana的端口),但沒有成功 – Dardar1991

回答

0

其實我已經成功,即使沒有在Kibana

首先創建它我用下面的配置文件創建索引 -

input { 
    file { 
    path => "/home/hadar/tmp/logs/server.log" 
    type => "test-type" 
    id => "NEWTRY" 
    start_position => "beginning" 
} 
} 

filter { 
    grok { 
    match => { "message" => "%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} %{HOUR:hour}:%{MINUTE:minute}:%{SECOND:second} - %{LOGLEVEL:level} - %{WORD:scriptName}.%{WORD:scriptEND} - " } 
    } 
} 

output { 
    elasticsearch { 
    hosts => ["localhost:9200"] 
    index => "new-index" 
    codec => line { format => "%{year}-%{month}-%{day} %{hour}:%{minute}:%{second} - %{level} - %{scriptName}.%{scriptEND} - \"%{message}\"" } 
    } 
} 

我確信,該​​指數是不是已經在Kibana(我試着用其他的索引名字來確定......),並且最終我在Kibana(我在索引模式部分添加了它)和Elasticsearch時看到了索引與日誌信息(當我去了http://localhost:9200/new-index

唯一我應該的這樣做是爲了消除其每Logstash後data/plugins/inputs/file/下創建的.sincedb_XXX文件運行

OR

其他解決方案(僅適用於測試環境)是添加sincedb_path=>"/dev/null"到指示不創建輸入文件的插件.sincedb_XXX文件

0

很顯然,您將無法找到您在Kibana中使用logstash創建的索引,除非您在KibanaManagemen部分中手動創建索引。

請確保您使用logstash創建的指示名稱相同。看一看在doc,傳達:

當你定義的索引模式,匹配模式必須 在Elasticsearch存在該指數。這些指數必須包含數據。

這幾乎說明指數應該存在爲您創建索引Kibana。希望能幫助到你!

+0

謝謝我想我錯過了解這些工具的概念......我認爲這是所有連接的工具,但我想這不是 – Dardar1991

+0

是的。它基本上是一堆產品,它有自己的處理方式。但是,ES作爲堆棧的核心。 – Kulasangar

相關問題