Skip to content

Instantly share code, notes, and snippets.

@gpilla
Last active March 13, 2018 19:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gpilla/2f590d372ca5907c4a26 to your computer and use it in GitHub Desktop.
Save gpilla/2f590d372ca5907c4a26 to your computer and use it in GitHub Desktop.
Logstash configuration for parsing PHP errors on Apache Log
filter {
if [type] == "apache_access" {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
}
filter {
if [type] == "apache_error" {
grok {
match => { "message" => "\[%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}\] \[:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_errormessage}:)?( \[client %{IPORHOST:client}:%{POSINT:clientport}\])? PHP %{DATA:php_error_level}: %{DATA:php_error} in %{DATA:php_file} on line %{POSINT:php_line}" }
}
grok {
match => { "message" => "\[%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}\] \[:%{LOGLEVEL:loglevel}\] \[pid %{POSINT:pid}\]( \(%{POSINT:proxy_errorcode}\)%{DATA:proxy_errormessage}:)?( \[client %{IPORHOST:client}:%{POSINT:clientport}\])? %{GREEDYDATA:message}" }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment