Logstash-Logstash 配置(四)output配置(3)写入到ES(重点)


 

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节点


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM