Skip to content

Instantly share code, notes, and snippets.

@tuapuikia
Forked from kamermans/php-error-logstash.conf
Created November 27, 2020 07:50
Show Gist options
  • Save tuapuikia/db51f1e2048822b4598620cba3d17626 to your computer and use it in GitHub Desktop.
Save tuapuikia/db51f1e2048822b4598620cba3d17626 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
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
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment