You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to use spring-cloud-gcp-logging with the STACKDRIVER appender from a service that runs in GKE. Our logs go to projects/my-project-id/logs/spring.log as expected, including trace and span. However in the resource.labels section the container_name is not set. All other fields in this section (cluster_name, location, namespace_name, pod_name, project_id) are all set to the expected values.
Is this potentially a bug in the logging library or simply a quirk of how Stackdriver works when not logging to STDOUT? If not a bug, is it possible to manually set this field via some logger configuration? Our intention was to use the container_name in our log search filters.
Spring Boot: 2.6.6
Spring Cloud 2021.0.1
Spring Cloud GCP: 3.2.1
I'm aware of the CONSOLE_JSON appender, which works great, but we have an unusual business case where we need unfiltered 'standard' logs as well as structured logs.
The text was updated successfully, but these errors were encountered:
It's a GKE-specific enhancement that's not currently part of our autoconfiguration. You can get this metadata with a workaround described here spring-attic/spring-cloud-gcp#2479.
Thanks for confirming, we can at least use the pod_name field with a bit of regex matching.
I found the MetadataConfig.getContainerName() method but on GKE it returns null. I was also not able to find a configuration class for logging, the class in the linked issue seems to be only for metrics. At least it had no effect on logging when I tried it.
We want to use
spring-cloud-gcp-logging
with theSTACKDRIVER
appender from a service that runs in GKE. Our logs go toprojects/my-project-id/logs/spring.log
as expected, including trace and span. However in theresource.labels
section thecontainer_name
is not set. All other fields in this section (cluster_name
,location
,namespace_name
,pod_name
,project_id
) are all set to the expected values.Is this potentially a bug in the logging library or simply a quirk of how Stackdriver works when not logging to STDOUT? If not a bug, is it possible to manually set this field via some logger configuration? Our intention was to use the
container_name
in our log search filters.I'm aware of the
CONSOLE_JSON
appender, which works great, but we have an unusual business case where we need unfiltered 'standard' logs as well as structured logs.The text was updated successfully, but these errors were encountered: