How do I set google stackdriver to respect logging severity from kubernetes?

5/15/2018

I deployed a go application in google cloud using kubernetes which automatically logs to google stackdriver. Oddly, all log statements are being tagged with severity "ERROR"

For example:

log.Println("This should have log level info")

will be tagged as an error.

Their docs say "Severities: By default, logs written to the standard output are on the INFO level and logs written to the standard error are on the ERROR level."

Anyone know what could be wrong with my setup?

-- Tony
go
kubernetes
logging
stackdriver

1 Answer

10/16/2018

Take a look at this logging package: github.com/teltech/logger, with an accompanying blog post. It will output your logs in a JSON format, including the severity, that is readable by the Stackdriver Fluentd agent.

-- nijm
Source: StackOverflow