Skip to content

Instantly share code, notes, and snippets.

@mingder78
Created December 8, 2016 03:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mingder78/4fa524db8cce492f7166d2cbaa4c5f38 to your computer and use it in GitHub Desktop.
Save mingder78/4fa524db8cce492f7166d2cbaa4c5f38 to your computer and use it in GitHub Desktop.
apache-error-log.conf
input {
file {
path => [ "/diskZ/elklog/axa/ssm*/error_log*" ]
start_position => beginning
type => "axa-apache-error"
sincedb_path => "/dev/null"
ignore_older => 0
}
}
filter {
if [type] == "axa-apache-error" {
grok {
match => { "message" => "\[%{DAY} (?<timestamp>%{MONTH} %{MONTHDAY} %{TIME} %{YEAR})\] \[%{LOGLEVEL:loglevel}\] (?:\[client %{IP:clientip}\] ){0,1}%{GREEDYDATA:errormsg}" }
}
date {
match => [ "timestamp" , "MMM dd HH:mm:ss YYYY" ]
}
geoip {
source => "clientip"
}
}
}
output {
if [type] == "axa-apache-error" {
elasticsearch {
hosts => ["localhost:9200"]
index => "logstash-axa-errorlog-%{+YYYY.MM.dd}"
}
#stdout { codec => rubydebug }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment