samber / samber/slog-betterstack

Add attributes on top level

Open
#12 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
14
Forks
5
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how instance.With("scope", "my-scope") is processed by the Betterstack handler and why it becomes extra.scope. Compare that path with the top-level log record structure described in the issue. Done means default attributes appear as top-level fields and remain usable for Betterstack queries.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.