|
logstash#vi nginx_logs.conf
input {
file {
type => "nginx-access"
path => "/www/log/nginx/access/default.log"
start_position => "beginning"
}
}
filter {
if [type] == "nginx-access" {
grok {
match => { "message" => "%{NGINXACCESS}" }
}
date {
match => [ "timestamp" , "dd/MMM/YYYY:HH:mm:ss Z" ]
}
geoip {
source => "clientip"
target => "geoip"
database =>"/server/logstash/vendor/geoip/GeoLiteCity.dat"
add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ]
}
mutate {
convert => [ "[geoip][coordinates]", "float" ]
}
}
}
output {
redis {
host => "10.252.35.170"
port => 6379
data_type => "list"
key => "logstash"
}
}
|
|
|