Skip to content

Conversation

@AbhiPrasad
Copy link
Member

resolves https://linear.app/getsentry/issue/LOGS-28

After testing with some SDKs and getting feedback, we've decided on a list of default attributes the SDKs should try to attach to logs.

This includes

  1. user attributes from https://develop.sentry.dev/sdk/data-model/event-payloads/user/
  2. browser attributes, parsed from user agents (feat(ourlogs): Add browser name/version to logs relay#4757)
  3. os and device attributes attached to mobile, desktop, and native sdks, based on https://develop.sentry.dev/sdk/data-model/event-payloads/contexts/

I also re-organized this section to make things a bit more clear.

@AbhiPrasad AbhiPrasad self-assigned this May 26, 2025
@vercel
Copy link

vercel bot commented May 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2025 11:19pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview May 27, 2025 11:19pm
sentry-docs ⬜️ Ignored (Inspect) Visit Preview May 27, 2025 11:19pm

Beyond these attributes, we are exploring if the SDK should also send OS, user, and device information automatically (via reading the appropriate contexts from the scope). Given this behaviour can easily be added as a new feature to the SDK, it does not have to be part of the initial SDK implementation until we make a finalized decision.
#### User Attributes

If the log is associated with a user, the SDK should attach the following if available:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add that these user attributes should only be added if sendDefaultPii: true.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with 769c92d

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding that. I asked a few questions on why we use a subset of available attributes. We can also follow up on these questions in other PRs. Apart from that, LGTM.

Comment on lines +276 to +277
4. `sentry.sdk.name`: The name of the SDK that sent the log
5. `sentry.sdk.version`: The version of the SDK that sent the log
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also plan to support integrations, features, and settings that already exist? These can be handy for investigating issues and tracking the adoption of integrations and features.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the current moment no. We want to avoid making the payload too large.

We can re-evaluate this based on internal and external feedback.


1. `user.id`: The user ID. Maps to `id` in the [User](/sdk/data-model/event-payloads/user/) payload.
2. `user.name`: The username. Maps to `username` in the [User](/sdk/data-model/event-payloads/user/) payload.
3. `user.email`: The email address. Maps to `email` in the [User](/sdk/data-model/event-payloads/user/) payload.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the other existing attributes such as ip_address, geo, city, country_code and region? If we deliberately decided against having these, it would be good to explain here why.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geo, city, country_code and region are set by Relay.


#### Mobile, Desktop, and Native SDKs

For mobile, desktop, and native SDKs (Android, iOS, Electron, etc.), the SDKs should attach the following:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again why is this list incomplete? What drove us to only add a subset? It's OK, but we should point out why here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a note as part of 9fc6809 to address this.

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) May 27, 2025 23:09
@AbhiPrasad AbhiPrasad merged commit 725460a into master May 27, 2025
12 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-default-attributes-logs branch May 27, 2025 23:19
"device.brand": "Apple",
"device.model": "iPhone 15 Pro Max",
"device.family": "iPhone"
}
Copy link
Member

@romtsn romtsn Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AbhiPrasad do we plan to normalize logs too? Asking because e.g. for Android we backfill device.name to a human-readable name here, so it becomes e.g. Galaxy Tab A7 instead of SM-T500 or something like that. Would be great to have that for logs eventually, I suppose.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

antonpirker pushed a commit that referenced this pull request Jun 6, 2025
…lts for every platform (#13832)

resolves https://linear.app/getsentry/issue/LOGS-28

After testing with some SDKs and getting feedback, we've decided on a
list of default attributes the SDKs should try to attach to logs.

This includes
1. user attributes from
https://develop.sentry.dev/sdk/data-model/event-payloads/user/
2. browser attributes, parsed from user agents
(getsentry/relay#4757)
3. os and device attributes attached to mobile, desktop, and native
sdks, based on
https://develop.sentry.dev/sdk/data-model/event-payloads/contexts/

I also re-organized this section to make things a bit more clear.

---------

Co-authored-by: Philipp Hofmann <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Jun 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants