diff --git a/src/content/docs/workers/observability/logs/index.mdx b/src/content/docs/workers/observability/logs/index.mdx index 079d0fe4e23b79..3f82a25030ef54 100644 --- a/src/content/docs/workers/observability/logs/index.mdx +++ b/src/content/docs/workers/observability/logs/index.mdx @@ -1,13 +1,14 @@ --- pcx_content_type: navigation -title: Log Management +title: Logs sidebar: + order: 2 group: hideIndex: false --- import { DirectoryListing } from "~/components"; -Use different methods of logging throughout the entire software development lifecycle of your Worker project. + diff --git a/src/content/docs/workers/observability/logs/real-time-logs.mdx b/src/content/docs/workers/observability/logs/real-time-logs.mdx index c7e96f72b99cbc..2e064c51c1d17d 100644 --- a/src/content/docs/workers/observability/logs/real-time-logs.mdx +++ b/src/content/docs/workers/observability/logs/real-time-logs.mdx @@ -4,6 +4,8 @@ title: Real-time logs head: [] description: Debug your Worker application by accessing logs and exceptions through the Cloudflare dashboard or `wrangler tail`. +sidebar: + order: 3 --- import { TabItem, Tabs, Steps } from "~/components"; diff --git a/src/content/docs/workers/observability/logs/tail-workers.mdx b/src/content/docs/workers/observability/logs/tail-workers.mdx index 4f4662c3554bb2..70a20fa15d5ab9 100644 --- a/src/content/docs/workers/observability/logs/tail-workers.mdx +++ b/src/content/docs/workers/observability/logs/tail-workers.mdx @@ -5,6 +5,7 @@ head: [] description: Track and log Workers on invocation by assigning a Tail Worker to your projects. sidebar: + order: 4 badge: text: Beta diff --git a/src/content/docs/workers/observability/logs/workers-logpush.mdx b/src/content/docs/workers/observability/logs/workers-logpush.mdx index a2c55869ad8028..cdb232e83250cb 100644 --- a/src/content/docs/workers/observability/logs/workers-logpush.mdx +++ b/src/content/docs/workers/observability/logs/workers-logpush.mdx @@ -4,6 +4,8 @@ title: Workers Logpush head: [] description: Send Workers Trace Event Logs to a supported third party, such as a storage or logging provider. +sidebar: + order: 5 --- @@ -19,7 +21,9 @@ Workers Trace Events Logpush is not available for zones on the [Cloudflare China ## Verify your Logpush access -Workers Logpush requires a Wrangler version of `2.2.0` or higher. Check your version by running `wrangler version`. To update Wrangler, refer to [Install/Update Wrangler](/workers/wrangler/install-and-update/). +:::note[Wrangler version] +Minimum required Wrangler version: 2.2.0. Check your version by running `wrangler version`. To update Wrangler, refer to [Install/Update Wrangler](/workers/wrangler/install-and-update/). +::: To configure a Logpush job, verify that your Cloudflare account role can use Logpush. To check your role: @@ -40,6 +44,7 @@ To create a Logpush job in the Cloudflare dashboard: 3. Select **Add Logpush job**. 4. Select **Workers trace events** as the data set > **Next**. 5. If needed, customize your data fields. Otherwise, select **Next**. + 6. Follow the instructions on the dashboard to verify ownership of your data's destination and complete job creation. ### Via cURL diff --git a/src/content/docs/workers/observability/logs/workers-logs.mdx b/src/content/docs/workers/observability/logs/workers-logs.mdx index 827e79ac023e7b..b6671ecac1f362 100644 --- a/src/content/docs/workers/observability/logs/workers-logs.mdx +++ b/src/content/docs/workers/observability/logs/workers-logs.mdx @@ -4,6 +4,7 @@ title: Workers Logs head: [] description: Store, filter, and analyze log data emitted from Cloudflare Workers. sidebar: + order: 2 badge: variant: tip text: New @@ -14,7 +15,6 @@ import { TabItem, Tabs, Steps } from "~/components" Workers Logs is a fully managed service that allows you to collect, store, filter, and analyze logging data emitted from Cloudflare Workers. Logs include [execution logs](/workers/observability/logs/workers-logs/#execution-logs), [custom logs](/workers/observability/logs/workers-logs/#add-custom-logs), errors, and uncaught exceptions. All newly created Workers will come with the observability setting enabled by default. Workers Logs is available to all developers. - ![Example showing the Workers Logs Dashboard](~/assets/images/workers-observability/preview.png) If you want to send logs to a third party, use [Workers Logpush](/workers/observability/logging/logpush/) or [Tail Workers](/workers/observability/logging/tail-workers/). @@ -58,6 +58,12 @@ To view Workers logs associated with any deployed Worker using the Cloudflare da 3. In **Overview**, select your **Worker** > and select **Logs**. +## Best Practices + +### Logging JSON objects + +To get the most out of Workers Logs, it is recommended to log in JSON format. Workers Logs automatically extracts the fields and indexes < TODO > + ## Features ### Add custom logs @@ -116,9 +122,9 @@ Head-based sampling allows you to log only a subset of incoming requests to your To enable head-based sampling, simply set `head_sampling_rate` within the observability configuration. For example, setting a sampling rate of 0.01 (1%) will log one out of every one hundred requests. If the `head_sampling_rate` is unspecified, it is configured to a default value of 1 (100%). -### Summary Logs +### Execution Logs -Each Workers invocation returns an execution log that contain details about the Request, Response, and related metadata. +Each Workers invocation returns an execution log that contain details about the Request, Response, and related metadata. ## Limits @@ -144,7 +150,7 @@ Each Workers invocation returns an execution log that contain details about the #### Example 1 -A Worker serves 15 million requests per month. Each request emits 1 summary log and 1 `console.log`. `head_sampling_rate` is configured to 1. +A Worker serves 15 million requests per month. Each request emits 1 execution log and 1 `console.log`. `head_sampling_rate` is configured to 1. | | Monthly Costs | Formula | | ---------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------- | @@ -153,7 +159,7 @@ A Worker serves 15 million requests per month. Each request emits 1 summary log #### Example 2 -A Worker serves 1 billion requests per month. Each request emits 1 summary log and 1 `console.log`. `head_sampling_rate` is configured to 0.1. +A Worker serves 1 billion requests per month. Each request emits 1 execution log and 1 `console.log`. `head_sampling_rate` is configured to 0.1. | | Monthly Costs | Formula | | ---------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------- |