Skip to content

Document default sdk logging attributes #14353

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/platforms/android/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ With Sentry Structured Logs, you can send text based log information from your a
## Options

<PlatformContent includePath="logs/options" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/dart/guides/flutter/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ With Sentry Structured Logs, you can send text based log information from your a
## Options

<PlatformContent includePath="logs/options" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
12 changes: 12 additions & 0 deletions docs/platforms/go/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,15 @@ if err := sentry.Init(sentry.ClientOptions{
### Debug

If the `Debug` init option is set to true, calls to the `sentry.Logger` will also print to the console with the appropriate log level.

## Default Attributes

The Go SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/go.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/server.mdx" />
4 changes: 4 additions & 0 deletions docs/platforms/java/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ With Sentry Structured Logs, you can send text based log information from your a
## Options

<PlatformContent includePath="logs/options" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/javascript/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ With Sentry Structured Logs, you can send text based log information from your a
## Options

<PlatformContent includePath="logs/options" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/php/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ Let us know what you would like to see on GitHub: [Symfony Logs](https://github.
## Options

<PlatformContent includePath="logs/options" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/python/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ With Sentry Structured Logs, you can send text based log information from your a
## Options

<PlatformContent includePath="logs/options" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
4 changes: 4 additions & 0 deletions docs/platforms/react-native/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ With Sentry Structured Logs, you can send text based log information from your a
## Options

<PlatformContent includePath="logs/options" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
8 changes: 8 additions & 0 deletions docs/platforms/ruby/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ With Sentry Structured Logs, you can send text based log information from your a
## Usage

<PlatformContent includePath="logs/usage" />

## Options

<PlatformContent includePath="logs/options" />

## Default Attributes

<PlatformContent includePath="logs/default-attributes" />
12 changes: 12 additions & 0 deletions docs/platforms/rust/common/logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,15 @@ let _guard = sentry::init(("___PUBLIC_DSN___", sentry::ClientOptions {
..Default::default()
}));
```

## Default Attributes

The Rust SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/rust.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/server.mdx" />
9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/android.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Android SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/android.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/mobile.mdx" />
6 changes: 6 additions & 0 deletions platform-includes/logs/default-attributes/browser.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Browser Attributes

For browser-based applications:

- `browser.name`: Display name of the browser application
- `browser.version`: Version string of the browser
7 changes: 7 additions & 0 deletions platform-includes/logs/default-attributes/core.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Core Attributes

- `sentry.environment`: The environment set in the SDK if defined
- `sentry.release`: The release set in the SDK if defined
- `sentry.trace.parent_span_id`: The span ID of the span that was active when the log was collected (only set if there was an active span)
- `sentry.sdk.name`: The name of the SDK that sent the log
- `sentry.sdk.version`: The version of the SDK that sent the log
9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/dart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Dart SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/dart.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/mobile.mdx" />
9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/java.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Java SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/java.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/server.mdx" />
11 changes: 11 additions & 0 deletions platform-includes/logs/default-attributes/javascript.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
The JavaScript SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/javascript.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/browser.mdx" />

<Include name="logs/default-attributes/server.mdx" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using format specifiers, the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using format specifiers, the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using format specifiers (like `%v`), the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using format specifiers (like `%s`), the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using `logger.fmt` or format strings, the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using format specifiers (like `%s`), the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using `{attribute_name}` placeholder syntax, the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position or name
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using format specifiers (like `%s`), the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Message Template Attributes

If the log was parameterized using format specifiers, the SDK will also set:

- `sentry.message.template`: The parameterized template string
- `sentry.message.parameter.X`: The parameters to the template string, where X is the parameter's position
9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/mobile.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Mobile and Native Device Attributes

For mobile applications:

- `os.name`: The name of the operating system
- `os.version`: The version of the operating system
- `device.brand`: The brand of the device
- `device.model`: The model of the device
- `device.family`: The family of the device
Copy link
Member

Choose a reason for hiding this comment

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

The list on mobile will grow for sure. I would at least add simulator for now cause that's important and all mobile SDKs should send this.

Suggested change
- `device.family`: The family of the device
- `device.simulator`: A flag indicating whether this device is a simulator or an actual
device.

9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/php.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The PHP SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/php.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/server.mdx" />
9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/python.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Python SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/python.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/server.mdx" />
9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/react-native.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The React Native SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/javascript.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/mobile.mdx" />
9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/ruby.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Ruby SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/ruby.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/server.mdx" />
9 changes: 9 additions & 0 deletions platform-includes/logs/default-attributes/rust.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Rust SDK automatically sets several default attributes on all log entries to provide context and improve debugging:

<Include name="logs/default-attributes/core.mdx" />

<Include name="logs/default-attributes/message-template/rust.mdx" />

<Include name="logs/default-attributes/user.mdx" />

<Include name="logs/default-attributes/server.mdx" />
5 changes: 5 additions & 0 deletions platform-includes/logs/default-attributes/server.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Server Attributes

For backend applications:

- `server.address`: The address of the server that sent the log (equivalent to server_name attached to errors and transactions)
7 changes: 7 additions & 0 deletions platform-includes/logs/default-attributes/user.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### User Attributes

If user information is available in the current scope:

- `user.id`: The user ID
Comment on lines +3 to +5
Copy link
Member

Choose a reason for hiding this comment

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

On mobile, SDKs always provide a default user ID if none is set on the scope, which is required for release health. The SDKs use the installationId as a fallback, which they generate randomly once during the app installation:

So users don't need to set the user.id manually on the scope. When reading this, they might believe they have to set the user.id manually now. Maybe it makes sense to create an extra default attributes page for these SDKs.

- `user.name`: The username
- `user.email`: The email address
Loading