Last active
March 13, 2018 19:20
-
-
Save gpilla/2f590d372ca5907c4a26 to your computer and use it in GitHub Desktop.
Logstash configuration for parsing PHP errors on Apache Log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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