How does stackdriver logging assert the severity of an entry?

4/4/2017

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.

-- Till Klocke
google-cloud-platform
google-kubernetes-engine
logging
stackdriver

2 Answers

8/14/2018

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).

-- ticofab
Source: StackOverflow

5/25/2017

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).

-- Igor Peshansky
Source: StackOverflow