[DEPRECATED] Kubernetes Engine Handler¶
Deprecated since version 3.0.0: Use StructuredLogHandler
instead.
Logging handler for Google Container Engine (GKE).
Formats log messages in a JSON format, so that Kubernetes clusters with the fluentd Google Cloud plugin installed can format their log messages so that metadata such as log level is properly captured.
- class google.cloud.logging_v2.handlers.container_engine.ContainerEngineHandler(*, name=None, stream=None)[source]¶
Bases:
logging.StreamHandler
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.
- Parameters
name (Optional[str]) – The name of the custom log in Cloud Logging.
stream (Optional[IO]) – Stream to be used by the handler.
- format(record)[source]¶
Format the message into JSON expected by fluentd.
- Parameters
record (logging.LogRecord) – The log record.
- Returns
A JSON string formatted for GKE fluentd.
- Return type