Logstash 配置(四)output配置
寫入到ES(重點)
[root@bigdata111 confs_test]# vi output_es_stdin.conf
配置:
input {
stdin {
type => "log2es"
}
}
output {
elasticsearch {
hosts => ["192.168.212.111:9200"]
index => "logstash-%{type}-%{+YYYY.MM.dd}"
document_type => "%{type}"
sniffing => true
template_overwrite => true
}
}
注:
sniffing:是否尋找其它節點(如果是一個集群中的節點,一個節點沒連接上,是否要連接其他節點)
------------------------------------------------
啟動ES-是用非root用戶啟動的:
[root@bigdata111 ~]# su demouser
[demouser@bigdata111 root]$ cd /usr/local/elasticsearch-6.1.1
[demouser@bigdata111 elasticsearch-6.1.1]$ bin/elasticsearch
啟動LS:
[root@bigdata111 confs_test]# ../bin/logstash -f ./output_es_stdin.conf
啟動好后在控制台輸入數據:hello hello hello
在head插件中可以看到數據。
sniffing : 尋找其他es節點