-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Export logs as json to Google Cloud Logging #36845
Comments
The logging exporter will attempt to export json-structured logs if the value type is Map or Bytes, and is able to be converted to json: https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/8da0f42dab085c916987891419461d583a2aa96e/exporter/collector/logs.go#L503 Let me know if you need help formatting logs in that way. |
Yes please, would you have any suggestions on how to achieve the same. But since the exporter does support the same, that gives me more to work with. Spring Boot supports structured logging out of the box now. More to explore. |
You will want to use the transform:
log_statements:
- context: log
statements:
- set(attributes["body"], body)
- set(body, attributes) That moves the existing body into attributes, and then moves all attributes (which is a map) into the body |
Ah, you probably need to delete attributes as well (since they are now moved to the body. I updated the example above to use keep_keys to remove all keys. |
Component(s)
exporter/googlecloud
Is your feature request related to a problem? Please describe.
Currently the Google Cloud exporter sends the logs in an unstructured format under textPayload.
Describe the solution you'd like
Provide option to send the logs in a structured manner as json with the right mappings.
Describe alternatives you've considered
Going to try and look into transforming it ourselves
Additional context
No response
The text was updated successfully, but these errors were encountered: