From 43a00885a73ccc43b5b640d2c0e71b716e0b568c Mon Sep 17 00:00:00 2001 From: cbehera-newrelic Date: Mon, 16 Dec 2024 16:02:19 +0530 Subject: [PATCH] Reverting the merging for auto-logging --- .../browser-pro-features/auto-logging.mdx | 144 ++++++++++++++++++ .../browser-pro-features/session-replay.mdx | 2 +- .../browser-apis/recordReplay.mdx | 1 - 3 files changed, 145 insertions(+), 2 deletions(-) create mode 100644 src/content/docs/browser/browser-monitoring/browser-pro-features/auto-logging.mdx diff --git a/src/content/docs/browser/browser-monitoring/browser-pro-features/auto-logging.mdx b/src/content/docs/browser/browser-monitoring/browser-pro-features/auto-logging.mdx new file mode 100644 index 00000000000..3d872b4531f --- /dev/null +++ b/src/content/docs/browser/browser-monitoring/browser-pro-features/auto-logging.mdx @@ -0,0 +1,144 @@ +--- +title: "Automatically detect browser logs" +metaDescription: "Get a more complete picture of your front-end application" +freshnessValidatedDate: 2024-11-18 +--- + +Auto logging collects log messages issued from the browser `console` to help you maximize observability of your front-end applications. + +Browser logs are tracked by default at the `WARN` level for Pro and Pro+SPA agents, but unavailable for the Lite browser agent. We recommend that you first confirm you're using the Pro or Pro+SPA agent. See [Getting Started](#get-started). + +## How browser auto-logging works [#how-it-works] + +Based on logging levels and sampling rates set in the configuration, auto-instrumentation of browser logs will attempt to collect messages from the following methods: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Method + + Level +
+ `console.log` + + `'INFO'` +
+ `console.error` + + `'ERROR'` +
+ `console.warn` + + `'WARN'` +
+ `console.info` + + `'INFO'` +
+ `console.debug` + + `'DEBUG'` +
+ `console.trace` + + `'TRACE'` +
+ + +Data passed through the console methods may go through serialization and [obfuscation](/docs/browser/new-relic-browser/configuration/obfuscate-browser-agent-data/). Depending on the size and frequency, this may negatively impact application performance as well as data costs. In general, it is NOT recommended to pass in large objects or large amounts of data into console methods. + + +By default, logging data is stored for 30 days, but actual data retention depends on your account. + +## Get started [#get-started] + + + + ### Enable automatic log collection [#enable-configure-settings] + + 1. Go to **[one.newrelic.com](https://one.newrelic.com/all-capabilities) > All Capabilities > Browser**. + 2. Select your browser app. + 3. In the left-hand menu, click **Application settings**. + 4. On the Application settings page, make sure **Pro** or **Pro + SPA** browser agent is selected. Automatic log detection is not available for the Lite browser agent. + 5. Toggle ON **Browser logs** setting. + + + + ### Configure sampling rates [#configure-sampling-rates] + + Set a sampling rate (0%-100%) for the following samples: + + * **User sessions** records a random sample of all user sessions. + + For example, if you set the session sampling rate to 50%, it means that: + + * Half of all user sessions will automatically collect log events. + + + + ### View log events [#view-events] + + You can find logging data in two places: + + * On the **Logs** page: + + 1. Go to: **[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > Logs**. For details on what you can do in the UI, see [Logs UI](/docs/logs/ui-data/use-logs-ui). + + You can also query the `Log` data type. Here's a simple example NRQL query: + + ```sql + SELECT * FROM Log + ``` + + You can also use NerdGraph, our GraphQL-format API to [query data](/docs/apis/nerdgraph/examples/nerdgraph-nrql-tutorial), or to [configure log management](/docs/apis/nerdgraph/examples/nerdgraph-log-parsing-rules-tutorial). + + * On the **Errors inbox** page: + + 1. In the left-hand browser menu, click **Errors**. + 2. Click on the **Triage** and **Group errors** pages to see logs attached to errors. + + + +## Data consumption [#data-consumption] + +Logs follow the same consumption pricing as your other browser bytes. The amount of bytes produced depends on the count and length of messages. + +The auto logging feature eliminates the need to call the `newrelic.log` or `newrelic.wrapLogger` browser APIs, except when adding custom attributes to logging events. diff --git a/src/content/docs/browser/browser-monitoring/browser-pro-features/session-replay.mdx b/src/content/docs/browser/browser-monitoring/browser-pro-features/session-replay.mdx index 1c311c3e7fa..c62e2064d60 100644 --- a/src/content/docs/browser/browser-monitoring/browser-pro-features/session-replay.mdx +++ b/src/content/docs/browser/browser-monitoring/browser-pro-features/session-replay.mdx @@ -43,7 +43,7 @@ For more details on session replay, see the following sections: 2. Select your browser app. 3. In the left-hand menu, click **Application settings**. 4. On the Application settings page, make sure **Pro** or **Pro + SPA** browser agent is selected. Session replay is not available for the Lite browser agent. - 5. Toggle ON **Session tracking** and **Session replay** settings. + 5. Toggle ON **Session traces** and **Session replay** settings. diff --git a/src/content/docs/browser/new-relic-browser/browser-apis/recordReplay.mdx b/src/content/docs/browser/new-relic-browser/browser-apis/recordReplay.mdx index 5322bd9e04a..1c5dab2f3d6 100644 --- a/src/content/docs/browser/new-relic-browser/browser-apis/recordReplay.mdx +++ b/src/content/docs/browser/new-relic-browser/browser-apis/recordReplay.mdx @@ -28,7 +28,6 @@ Browser API used to force a replay to start recording. `newrelic.recordReplay()` can be called to manually force a replay to begin recording. You must meet the following requirements: * Account is entitled to record replays -* Session Tracking is Enabled * Session Trace is Enabled * Browser mutation observer global is present in the current version of the browser being used * The Session Replay feature is either normally imported, or set to `autoStart: false` and has already been "started"