7.案例logstash写入elasticsearch
数据直接写入elasticsearch中(适合日志数量不大,没有Redis)
[root@linux-node3 conf.d]# cat input_file_output_es.confinput {#systemsyslog {type => "system_rsyslog"host => "192.168.90.203"port => "514"}#javafile {path => "/var/log/elasticsearch/xuliangwei.log"type => "error_es"start_position => "beginning"codec => multiline {pattern => "^\["negate => truewhat => "previous"}}#nginxfile {path => "/var/log/nginx/access_json.log"type => "access_nginx"codec => "json"start_position => "beginning"}}output {#多行文件判断if [type] == "system_rsyslog" {elasticsearch {hosts => ["192.168.90.201:9200","192.168.90.202:9200"]index => "system_rsyslog_%{+YYYY.MM}"}}if [type] == "error_es" {elasticsearch {hosts => ["192.168.90.201:9200","192.168.90.202:9200"]index => "error_es_%{+YYYY.MM.dd}"}}if [type] == "access_nginx" {elasticsearch {hosts => ["192.168.90.201:9200","192.168.90.202:9200"]index => "access_nginx_%{+YYYY.MM.dd}"}}}
东方
浙公网安备 33010602011771号