I recently started using stackdriver logging on my Kubernetes cluster. The service are logging json payloads. In stackdriver logging I see the json payload parsed correctly, but everything has severity "ERROR". This is not intended. Most of these logs aren't errors. They also do not contain error fields or similar fields. Is there a way to tell stackdriver how to determine the severity of a log entry received from the log agent in kubernetes? Or do I need to modify my structured log output in some way to make stackdriver understand it better?
Thanks in advance.
If you put a severity
field into your JSON record, the Stackdriver logging agent should turn that into the entry severity. Otherwise it hard-codes ERROR for stderr
and INFO for stdout
(for Kubernetes logs).
A simple example of payload: as of August 2018, if you log the string
{"msg" : "starting", "severity" : "INFO"}
Stackdriver will show
{
...
jsonPayload: { msg: "starting" },
severity: "INFO"
}
and the resulting severity will be INFO
(with the blue icon).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With