From 8cc7425ebc5f539b860b965c26cdc74ce4ba181e Mon Sep 17 00:00:00 2001 From: lucas Date: Fri, 13 Mar 2026 12:42:34 +0000 Subject: [PATCH 1/3] mention how to drop sdk logs, refactor the location of log property definition Co-authored-by: Claude --- includes/logs/default-attributes/integration.mdx | 15 +++++++++++++++ .../logs/default-attributes/react-native.mdx | 9 +++++++++ platform-includes/logs/options/react-native.mdx | 7 ------- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/includes/logs/default-attributes/integration.mdx b/includes/logs/default-attributes/integration.mdx index cfa7d109eb2a28..dbf62530487599 100644 --- a/includes/logs/default-attributes/integration.mdx +++ b/includes/logs/default-attributes/integration.mdx @@ -3,3 +3,18 @@ If a log is generated by an SDK integration, the SDK will set additional attributes to help you identify the source of the log. - `origin`: The origin of the log. This is sent from the SDK as `sentry.origin`. + +To filter out all SDK-generated logs and only keep your application logs, use the following snippet: + +```js +Sentry.init({ + dsn: "___PUBLIC_DSN___", + enableLogs: true, + beforeSendLog: (log) => { + if (log.attributes?.["sentry.origin"] !== undefined) { + return null; + } + return log; + }, +}); +``` diff --git a/platform-includes/logs/default-attributes/react-native.mdx b/platform-includes/logs/default-attributes/react-native.mdx index 6e2d611919d282..c5e130d1666d04 100644 --- a/platform-includes/logs/default-attributes/react-native.mdx +++ b/platform-includes/logs/default-attributes/react-native.mdx @@ -11,3 +11,12 @@ The React Native SDK automatically sets several default attributes on all log en + +### Log Object Properties + +The log object has the following properties: + +- `level`: (string - one of `trace`, `debug`, `info`, `warn`, `error`, `fatal`) The log level. +- `message`: (string) The message to be logged. +- `timestamp`: (number) The timestamp of the log. +- `attributes`: (object) The attributes of the log. diff --git a/platform-includes/logs/options/react-native.mdx b/platform-includes/logs/options/react-native.mdx index 759530e608b30d..ba2f914b0ae32d 100644 --- a/platform-includes/logs/options/react-native.mdx +++ b/platform-includes/logs/options/react-native.mdx @@ -18,10 +18,3 @@ Sentry.init({ ``` The `beforeSendLog` function receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it. - -The log object has the following properties: - -- `level`: (string - one of `trace`, `debug`, `info`, `warn`, `error`, `fatal`) The log level. -- `message`: (string) The message to be logged. -- `timestamp`: (number) The timestamp of the log. -- `attributes`: (object) The attributes of the log. From d805198f93777b6e88271fbbffb2fcf55c8a370b Mon Sep 17 00:00:00 2001 From: lucas Date: Fri, 13 Mar 2026 14:04:59 +0000 Subject: [PATCH 2/3] Move away from global data --- .../integration-filter-example/javascript.mdx | 14 ++++++++++++++ includes/logs/default-attributes/integration.mdx | 15 --------------- .../logs/default-attributes/react-native.mdx | 2 ++ 3 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 includes/logs/default-attributes/integration-filter-example/javascript.mdx diff --git a/includes/logs/default-attributes/integration-filter-example/javascript.mdx b/includes/logs/default-attributes/integration-filter-example/javascript.mdx new file mode 100644 index 00000000000000..bbdc054987b39f --- /dev/null +++ b/includes/logs/default-attributes/integration-filter-example/javascript.mdx @@ -0,0 +1,14 @@ +To filter out all SDK-generated logs and only keep your application logs, use the following snippet: + +```js +Sentry.init({ + dsn: "___PUBLIC_DSN___", + enableLogs: true, + beforeSendLog: (log) => { + if (log.attributes?.["sentry.origin"] !== undefined) { + return null; + } + return log; + }, +}); +``` diff --git a/includes/logs/default-attributes/integration.mdx b/includes/logs/default-attributes/integration.mdx index dbf62530487599..cfa7d109eb2a28 100644 --- a/includes/logs/default-attributes/integration.mdx +++ b/includes/logs/default-attributes/integration.mdx @@ -3,18 +3,3 @@ If a log is generated by an SDK integration, the SDK will set additional attributes to help you identify the source of the log. - `origin`: The origin of the log. This is sent from the SDK as `sentry.origin`. - -To filter out all SDK-generated logs and only keep your application logs, use the following snippet: - -```js -Sentry.init({ - dsn: "___PUBLIC_DSN___", - enableLogs: true, - beforeSendLog: (log) => { - if (log.attributes?.["sentry.origin"] !== undefined) { - return null; - } - return log; - }, -}); -``` diff --git a/platform-includes/logs/default-attributes/react-native.mdx b/platform-includes/logs/default-attributes/react-native.mdx index c5e130d1666d04..cc680cfa8d1579 100644 --- a/platform-includes/logs/default-attributes/react-native.mdx +++ b/platform-includes/logs/default-attributes/react-native.mdx @@ -12,6 +12,8 @@ The React Native SDK automatically sets several default attributes on all log en + + ### Log Object Properties The log object has the following properties: From b5ccef12a1a981e054d6863ebc66c34d8647d56c Mon Sep 17 00:00:00 2001 From: LucasZF Date: Fri, 20 Mar 2026 11:30:10 +0000 Subject: [PATCH 3/3] Update includes/logs/default-attributes/integration-filter-example/javascript.mdx Co-authored-by: Alex Krawiec --- .../integration-filter-example/javascript.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/logs/default-attributes/integration-filter-example/javascript.mdx b/includes/logs/default-attributes/integration-filter-example/javascript.mdx index bbdc054987b39f..bd50fd860da048 100644 --- a/includes/logs/default-attributes/integration-filter-example/javascript.mdx +++ b/includes/logs/default-attributes/integration-filter-example/javascript.mdx @@ -1,4 +1,4 @@ -To filter out all SDK-generated logs and only keep your application logs, use the following snippet: +To filter out all SDK-generated logs and keep only your application logs, use the following snippet: ```js Sentry.init({