filebeat配置
filebeat.inputs:
- type: log
enabled: true
paths:
- /usr/local/gwt/nginx/logs/*access.log
tags: ["access"]
json.keys_under_root: true
json.add_error_key: true
- type: log
enabled: true
paths:
- /usr/local/gwt/nginx/logs/error.log
tags: ["error"]
output.redis:
hosts: ["192.168.31.209:6379"]
password: "Aa123456"
key: "nginx_log"
db: 0
timeout: 5
logstash配置
vim /etc/logstash/conf.d/redis.conf
input {
redis {
host => "192.168.31.209"
password => "Aa123456"
port => "6379"
db => "0"
key => "nginx_log"
data_type => "list"
}
}
filter {
mutate {
convert => ["response_time","float"]
convert => ["request_time","float"]
}
}
output {
stdout{}
if "access" in [tags] {
elasticsearch {
hosts => "http://192.168.31.234:9200"
manage_template => false
index => "nginx_access-%{+yyy.MM}"
}
}
if "error" in [tags] {
elasticsearch {
hosts => "http://192.168.31.234:9200"
manage_template => false
index => "nginx_error-%{+yyy.MM}"
}
}
}