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

Add attributes on top level #12

Open
marcelhfm opened this issue Jan 7, 2025 · 2 comments
Open

Add attributes on top level #12

marcelhfm opened this issue Jan 7, 2025 · 2 comments

Comments

@marcelhfm
Copy link

Hey there,

is it possible to add default attributes to the top level of the log record?

This is useful to enable easier querying in betterstack, by e.g. adding the source tag on the top level of the record.

I have tried to add it to the record by using

instance.With("scope", "my-scope")

However this shows up as extra.scope in betterstack.

Thanks!

@samber
Copy link
Owner

samber commented Jan 7, 2025

What about making the ContextKey optional ?

When ContextKey=="", then add the attribute to the root. WDYT ?

@marcelhfm
Copy link
Author

Sounds good, I think this should work.

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

2 participants