I am currently trying to clean my google cloud log explorer and want to add summary fields to show up by default in the explorer like this:
My desired effect can be achieved by setting custom summary fields to show label values, but I want this behaviour by default.
Current code being used to generate the log:
from google.cloud import logging_v2
def write_entry(logger_name):
"""Writes log entries to the given logger."""
logging_client = logging_v2.Client(project="test-project")
# This log can be found in the Cloud Logging console under 'Custom Logs'.
logger = logging_client.logger("TEST",labels={"label1":"I want this to show in default summary field"})
# Make a simple text log
logger.log_text("Hello, world!")
print("Wrote logs to {}.".format(logger.name))
write_entry("test-log-bucket")
I would like the log entry label1
value in labels
to be shown where the circle is in the provided image.
All help and guidance is appreciated.