elk 索引

zjtest7-redis:/usr/local/logstash-2.3.4/config# cat logstash_agent.conf 
input {
        file {
                type => "nginx_access"
                path => ["/usr/local/nginx/logs/test.access.log"]
        }
}
output {
        redis {
                host => "localhost"
                data_type => "list"
                key => "logstash:redis"
                port=>"6379"
                password => "1234567"
        }
}


zjtest7-redis:/usr/local/logstash-2.3.4/config# cat logstash_indexer.conf 
input {
        redis {
                host => "localhost"
                data_type => "list"
                key => "logstash:redis"
                type => "redis-input"
                password => "1234567"
                port =>"6379"
        }
}
output {
        elasticsearch {
                hosts => "192.168.32.80:9200"
                index => "nginx_acc"
        }
		stdout {
			codec => rubydebug
		}
}

nginx配置;

http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format logstash '$http_host $server_addr $remote_addr [$time_local] "$request" '
                    '$request_body $status $body_bytes_sent "$http_referer" "$http_user_agent" '
                    '$request_time $upstream_response_time';

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /usr/local/nginx/logs/test.access.log  logstash;
	
	

这里logstash配置对了,自动建索引


posted @ 2016-07-22 22:28  czcb  阅读(229)  评论(0编辑  收藏  举报