Skip to content

Instantly share code, notes, and snippets.

@jsgao0
Created September 20, 2016 05:50
Show Gist options
  • Select an option

  • Save jsgao0/febd3edc9d10914a15eed45bdc0b3385 to your computer and use it in GitHub Desktop.

Select an option

Save jsgao0/febd3edc9d10914a15eed45bdc0b3385 to your computer and use it in GitHub Desktop.
Logstash config file on Ubuntu.
input {
file {
path => "/var/log/tomcat8/localhost_access_log*"
start_position => beginning
sincedb_path => "/dev/null"
ignore_older => 0
type => "access_log"
}
}
filter {
grok {
patterns_dir => "./patterns"
match => { "message" => "%{COMMONAPACHELOG}" }
add_tag => [ "combined_apache_log", "extended_tomcat_log" ]
}
date {
timezone => "Asia/Taipei"
match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
add_tag => [ "timestamped" ]
}
geoip {
source => "clientip"
database => "/geo/lite/city/database/path/GeoLiteCity.dat"
target => "geoip"
# fields => [ "city_name", "country_code2", "country_name", "location", "real_region_name", "postal_code" ]
add_field => [ "[geoip][coordinates]", "%{[geoip][longitude]}" ]
add_field => [ "[geoip][coordinates]", "%{[geoip][latitude]}" ]
add_tag => [ "geoip" ]
}
mutate {
convert => [ "[geoip][coordinates]", "float"]
}
}
output {
elasticsearch {
hosts => ["elasticsearch_name:9200"]
index => "dsahboard-raw"
document_type => "cartridge"
}
stdout {
codec => rubydebug
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment