Class ContainerEngineHandler (3.11.0)

ContainerEngineHandler(*, name=None, stream=None)

Handler to format log messages the format expected by GKE fluent.

This handler is written to format messages for the Google Container Engine (GKE) fluentd plugin, so that metadata such as log level are properly set.

DEPRECATED: use StructuredLogHandler to write formatted logs to standard out instead.

Methods

ContainerEngineHandler

ContainerEngineHandler(*, name=None, stream=None)
Parameters
Name Description
name Optional[str]

The name of the custom log in Cloud Logging.

stream Optional[IO]

Stream to be used by the handler.

format

format(record)

Format the message into JSON expected by fluentd.

Parameter
Name Description
record logging.LogRecord

The log record.

Returns
Type Description
str A JSON string formatted for GKE fluentd.