pythongoogle-cloud-platformgoogle-cloud-logging

set log severity on google cloud without using google-cloud-logging library


I am trying to correctly output logs on my service running on google cloud, and for the most part they are correctly identified (DEBUG and INFO logs, being sent to stdout, are marked as info, whereas WARNING, ERROR, and CRITICAL logs are sent to stderr and are marked as error). Now, I am trying to get the exact severity out of them, without needing to use the google-cloud-logging library. Is there a way where I can accomplish this?

Here an example of what I currently obtain is shown, with severity (icon on the left) matching whether the log comes from stdout or stderr.

google cloud logging example

This is what I'm trying to obtain, but without using the google-cloud-logging library

expected log severities

Edit:

my logs are written to the output streams in json format, by using the python-json-logger library for python. My google cloud logs have their information stored as in the picture below. We are not using fluentd for log parsing.

current log parsing structure


Solution

  • After some research and help from @SerhiiRohoza It doesn't seem you can, so in order to set the severity on google cloud you need to add the google-cloud-logging library to your project and set it up as described on the documentation.