Google Container Engine - How do I specify the level of log messages?

4/27/2016

When logging on Google Container Engine, how do I communicate to the logging platform which level each message corresponds to?

That is, the logging platform supports associating each message with a log level, but I don't know how to do this when writing log messages from my application.

-- aknuds1
google-kubernetes-engine
logging
stackdriver

2 Answers

4/28/2016

If you're using the V2 API (beta), LogSeverity should be what you're looking for. (V1 as well, possibly. Haven't checked).

-- Matthias Winkelmann
Source: StackOverflow

4/29/2016

Currently there's only one way to get severity from your application into Cloud Logging without swapping out the default logging agent on the node (which actually isn't that hard): configure your app to log structured JSON. JSON will be automatically parsed by the logging agent, and the "severity" field will be understood by the platform if it's present.

-- Alex Robinson
Source: StackOverflow