Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support logName override #451

Open
gjuggler opened this issue Feb 17, 2021 · 0 comments
Open

Support logName override #451

gjuggler opened this issue Feb 17, 2021 · 0 comments

Comments

@gjuggler
Copy link

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant