Last active
July 31, 2023 11:31
-
-
Save kamermans/f53aa58bbd14a3fff9541b76064efa1a to your computer and use it in GitHub Desktop.
Logstash parser for PHP's error_log to combine multline stack traces / errors into one event
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
input { | |
stdin { | |
codec => multiline { | |
pattern => "^\[%{MONTHDAY}-%{MONTH}-%{YEAR} %{TIME} %{TZ}\]" | |
negate => true | |
what => "previous" | |
auto_flush_interval => 10 | |
} | |
type => "php-error" | |
} | |
} | |
filter { | |
grok { | |
match => { "message" => "^\[(?<logtime>%{MONTHDAY}-%{MONTH}-%{YEAR} %{TIME} %{TZ})\] ?%{GREEDYDATA:message}" } | |
overwrite => [ "message" ] | |
} | |
date { | |
match => [ "logtime", "d-MMM-yyyy HH:mm:ss ZZZ" ] | |
remove_field => [ "logtime" ] | |
} | |
} | |
output { | |
stdout { | |
codec => rubydebug | |
} | |
} | |
Hi @hecma002, this logstash configuration reads a PHP error log file and parses these multi-line messages into single events for further processing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to php-access?