在logstash安裝目錄下創(chuàng)建一個(gè)用于測(cè)試logstash使用elasticsearch作為logstash的后端的測(cè)試文件logstash.conf袍啡,該文件中定義了stdout和elasticsearch作為output苞轿,這樣的“多重輸出”即保證輸出結(jié)果顯示到屏幕上,同時(shí)也輸出到elastisearch中。
# cat logstash-es-simple.conf
input?{?stdin?{?}?}
output?{
elasticsearch?{host?=>?"localhost"?}
stdout?{?codec=>?rubydebug?}
}
執(zhí)行命令
.\logstash? -f .\logstash.conf
輸入信息
查看ES是否接收到了數(shù)據(jù):
或者可以使用命令
# curl 'http://localhost:9200/_search?pretty'
首先歉摧,配置一個(gè)索引灿意,默認(rèn),Kibana的數(shù)據(jù)被指向Elasticsearch扫沼,使用默認(rèn)的logstash-*的索引名稱出爹,并且是基于時(shí)間的,點(diǎn)擊“Create”即可缎除。
創(chuàng)建成功
點(diǎn)擊“Discover”严就,可以搜索和瀏覽Elasticsearch中的數(shù)據(jù),默認(rèn)搜索的是最近15分鐘的數(shù)據(jù)器罐∩椅可以自定義選擇時(shí)間。