You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Workers Logs lets you automatically collect, store, filter, and analyze logging data emitted from Cloudflare Workers. Data is written to your Cloudflare Account, and you can query it in the dashboard for each of your Workers. All newly created Workers will come with the observability setting enabled by default.
17
17
@@ -32,19 +32,19 @@ You must add the observability setting for your Worker to write logs to Workers
32
32
```toml
33
33
[observability]
34
34
enabled = true
35
-
head_sampling_rate = 0.01# optional. default = 1.
35
+
head_sampling_rate = 1# optional. default = 1.
36
36
```
37
37
38
38
The default value for `head_sampling_rate` is 1, meaning 100% of your logs are sampled. `head_sampling_rate` can be set to a value between 0 and 1. For example, 0.01 indicates that 1% of your logs are sampled.
39
39
40
40
### Enabling with environments
41
41
42
-
[Environments](workers/wrangler/environments/) allow you to deploy the same Worker application with different configurations. To configure observability for your environment:
42
+
[Environments](workers/wrangler/environments/) allow you to deploy the same Worker application with different configurations. For example, you may want to configure a different `head_sampling_rate` to staging and production. To configure observability for your environment:
43
43
1. Add the following configuration below `[env.<NAME>]`
44
44
```toml
45
45
[env.<NAME>.observability]
46
46
enabled = true
47
-
head_sampling_rate = 0.1 # optional
47
+
head_sampling_rate = 1 # optional
48
48
```
49
49
2. Deploy your Worker with `npx wrangler deploy -e <NAME>`
50
50
3. Repeat step 1 and 2 for each environment.
@@ -119,11 +119,11 @@ async function handleRequest(request) {
119
119
120
120
</TabItem> </Tabs>
121
121
122
-
After you deploy the above code, view your Worker's logs in [the dashboard](/workers/observability/logs/workers-logs/#view-logs-from-the-dashboard) or with [real-time logs](/workers/observability/logs/real-time-logs/).
122
+
After you deploy the code above, view your Worker's logs in [the dashboard](/workers/observability/logs/workers-logs/#view-logs-from-the-dashboard) or with [real-time logs](/workers/observability/logs/real-time-logs/).
123
123
124
124
### Head-based Sampling
125
125
126
-
Head-based sampling allows you to log only a subset of incoming requests to your Cloudflare Workers. Especially for high-traffic applications, this helps reduce log volume and manage costs, while still providing meaningful insights into your application’s performance. When you configure a head-based sampling rate, you can control the percentage of requests that get logged. All logs within the context of the request are collected.
126
+
Head-based sampling allows you to log only a subset of incoming requests to your Cloudflare Workers. Especially for high-traffic applications, this helps reduce log volume and manage costs, while still providing meaningful insights into your application's performance. When you configure a head-based sampling rate, you can control the percentage of requests that get logged. All logs within the context of the request are collected.
127
127
128
128
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%).
129
129
@@ -141,11 +141,10 @@ To enable head-based sampling, simply set `head_sampling_rate` within the observ
Copy file name to clipboardExpand all lines: src/content/docs/workers/platform/pricing.mdx
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,6 +186,16 @@ To change your default account-wide usage model:
186
186
187
187
Existing Workers will not be impacted when changing the default usage model. You may change the usage model for individual Workers without affecting your account-wide default usage model.
188
188
189
+
## Workers Logs
190
+
191
+
<Renderfile="workers_logs_pricing" />
192
+
193
+
:::note[Workers Logs documentation]
194
+
195
+
For more information and [examples of Workers Logs billing](/workers/observability/logs/workers-logs/#example-pricing), refer to the [Workers Logs documentation](/workers/observability/logs/workers-logs).
196
+
197
+
:::
198
+
189
199
## Workers Trace Events Logpush
190
200
191
201
Workers Logpush is only available on the Workers Paid plan.
0 commit comments