Created
May 16, 2014 22:02
-
-
Save GaryRogers/3e1d672a132a27b68ccd to your computer and use it in GitHub Desktop.
Monolog Logstash Config example
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 => "plain" } | |
} | |
filter { | |
# Pulls out fields from monolog text log. (Note, we don't send extra to our monolog) | |
grok { | |
match => [ "message", "%{MONOLOG} %{GREEDYDATA:mymessage}"] | |
} | |
json { | |
source => "context" | |
} | |
} | |
output { | |
stdout { codec => rubydebug } | |
} |
# Define Monolog pattern
MONOLOG \[%{TIMESTAMP_ISO8601:timestamp}\] %{DATA:logger}.%{LOGLEVEL:level}:
Or inline:
\[%{TIMESTAMP_ISO8601:timestamp}\] %{DATA:logger}.%{LOGLEVEL:level}: %{GREEDYDATA:message}
Log input example:
[2016-03-29 10:27:03] payroll-app.request.INFO: 204 PUT /employments/1/integration/status
Event output exemple:
{
"timestamp": [
[
"2016-03-29 10:27:03"
]
],
"logger": [
[
"payroll-app.request"
]
],
"level": [
[
"INFO"
]
],
"message": [
[
"204 PUT /employments/1/integration/status"
]
]
}
You need to add overwrite => [ "message" ]
to set properly the message
field.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, where does MONOLOG come from?