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
I'm a developer on the Terra project (a collaboration between Verily and the Broad Institute) who recently dug into some of the details of our logging infrastructure. Our core services are written in Java and run on GKE, using the default fluentd plugin to ingest logs to Cloud Logging.
I did some work recently to spruce up our JSON output to relay more of the trace & request context to Cloud Logging, by adding things like the logging.googleapis.com/trace, logging.googleapis.com/sourceLocation and httpRequest fields where applicable (see e.g. this PR and especially GoogleJsonLayout.java).
One thing I was slightly disappointed about was that Cloud Logging wouldn't show our logs in the "nested" format (as described in this blog post), presumably because nested logs need to have distinct log names (e.g. this field in the LogEntry proto).
I did a bit of digging to see if there were any workarounds available, but it looks like there's a pretty hardened assumption that nested logs need distinct log names.
From an application developer perspective, one really easy way to specify distinct log names would be for me to be able to override the logName from within my JSON output. For example, if I could do something like this:
// Export HTTP request logs with the logName "httpRequest"
{ message: "GET /status 200", httpRequest: { ... }, "logging.googleapis.com/logName": "httpRequestLog", "logging.googleapis.com/trace": 123, ... }
// Export normal logs without overriding the log name (which defaults to "stdout" in our case)
{ message: "Log message", "logging.googleapis.com/trace": 123 ... }
and the fluentd plugin could recognize this field and have it override the core LogEntry field (as is done for other "logging.googleapis.com" fields), that would feel like a very user-friendly way to allow GKE services to generate nested logs.
The text was updated successfully, but these errors were encountered:
Hi team –
I'm a developer on the Terra project (a collaboration between Verily and the Broad Institute) who recently dug into some of the details of our logging infrastructure. Our core services are written in Java and run on GKE, using the default fluentd plugin to ingest logs to Cloud Logging.
I did some work recently to spruce up our JSON output to relay more of the trace & request context to Cloud Logging, by adding things like the
logging.googleapis.com/trace
,logging.googleapis.com/sourceLocation
andhttpRequest
fields where applicable (see e.g. this PR and especially GoogleJsonLayout.java).One thing I was slightly disappointed about was that Cloud Logging wouldn't show our logs in the "nested" format (as described in this blog post), presumably because nested logs need to have distinct log names (e.g. this field in the LogEntry proto).
I did a bit of digging to see if there were any workarounds available, but it looks like there's a pretty hardened assumption that nested logs need distinct log names.
From an application developer perspective, one really easy way to specify distinct log names would be for me to be able to override the logName from within my JSON output. For example, if I could do something like this:
and the fluentd plugin could recognize this field and have it override the core LogEntry field (as is done for other "logging.googleapis.com" fields), that would feel like a very user-friendly way to allow GKE services to generate nested logs.
The text was updated successfully, but these errors were encountered: