diff --git a/src/content/changelog/containers/2026-09-08-per-container-observability.mdx b/src/content/changelog/containers/2026-09-08-per-container-observability.mdx new file mode 100644 index 00000000000..efb96ec4bc7 --- /dev/null +++ b/src/content/changelog/containers/2026-09-08-per-container-observability.mdx @@ -0,0 +1,39 @@ +--- +title: Configure observability per container application +description: Set observability for individual container applications in Wrangler. +products: + - containers +date: 2026-09-08 +--- + +import { WranglerConfig } from "~/components"; + +You can now configure observability for each container application when you deploy [Containers](/containers/) with [Wrangler](/workers/wrangler/). This lets you change logging for one container without changing the rest of your Worker. + +If you omit `containers[].observability`, Wrangler uses the top-level `observability` setting for that container. If you set it, the container setting overrides the top-level setting. + +Use `target_instance_percentage` or `target_instance_count` to apply an observability change to a subset of running instances. + + + +```jsonc +{ + "observability": { + "enabled": false, + }, + "containers": [ + { + "class_name": "MyContainer", + "image": "./Dockerfile", + "observability": { + "enabled": true, + "target_instance_percentage": 25, + }, + }, + ], +} +``` + + + +For more information about Workers Logs, refer to [Workers Logs](/workers/observability/logs/workers-logs/). diff --git a/src/content/docs/containers/faq.mdx b/src/content/docs/containers/faq.mdx index 77b127711ec..8420220cffc 100644 --- a/src/content/docs/containers/faq.mdx +++ b/src/content/docs/containers/faq.mdx @@ -12,12 +12,14 @@ import { Render, WranglerConfig } from "~/components"; ## How do Container logs work? -To get logs in the Dashboard, including live tailing of logs, toggle `observability` to true -in your Worker's wrangler config: +To get logs in the Dashboard, including live tailing of logs, turn on observability in +your Wrangler config. + +You can turn it on at the Worker level, which applies to containers by default: -```json +```jsonc { "observability": { "enabled": true @@ -27,6 +29,29 @@ in your Worker's wrangler config: +You can also configure observability per container: + + + +```jsonc +{ + "containers": [ + { + "class_name": "MyContainer", + "image": "./Dockerfile", + "observability": { + "enabled": true + } + } + ] +} +``` + + + +If a container sets `observability` in its container entry, it overrides the top-level +`observability` setting for that container. + Logs are subject to the same [limits as Worker logs](/workers/observability/logs/workers-logs/#limits), which means that they are retained for 3 days on Free plans and 7 days on Paid plans. diff --git a/src/content/docs/containers/platform/pricing.mdx b/src/content/docs/containers/platform/pricing.mdx index 38315e9c538..078b58a1c11 100644 --- a/src/content/docs/containers/platform/pricing.mdx +++ b/src/content/docs/containers/platform/pricing.mdx @@ -53,4 +53,4 @@ When you use Containers, incoming requests to your containers are handled by you Containers are integrated with the [Workers Logs](/workers/observability/logs/workers-logs/) platform, and billed at the same rate. Refer to [Workers Logs pricing](/workers/observability/logs/workers-logs/#pricing) for details. -When you [enable observability for your Worker](/workers/observability/logs/workers-logs/#enable-workers-logs) with a binding to a container, logs from your container will show in both the Containers and Observability sections of the Cloudflare dashboard. +When you [turn on observability for your Worker](/workers/observability/logs/workers-logs/#enable-workers-logs), or configure `observability` on a specific container, logs from that container will show in both the Containers and Observability sections of the Cloudflare dashboard. diff --git a/src/content/docs/workers/wrangler/configuration.mdx b/src/content/docs/workers/wrangler/configuration.mdx index d00bb62f126..ec5497c38f9 100644 --- a/src/content/docs/workers/wrangler/configuration.mdx +++ b/src/content/docs/workers/wrangler/configuration.mdx @@ -400,8 +400,10 @@ Example: The [Observability](/workers/observability/logs/workers-logs) setting allows you to automatically ingest, store, filter, and analyze logging data emitted from Cloudflare Workers directly from your Cloudflare Worker's dashboard. -- `enabled` - - When set to `true` on a Worker, logs for the Worker are persisted. Defaults to `true` for all new Workers. +- `enabled` + - Shorthand for `logs.enabled`. When set to `true` on a Worker, logs for the Worker are persisted. Defaults to `true` for all new Workers. +- `logs.enabled` + - Whether logs for the Worker are persisted. - `head_sampling_rate` - A number between 0 and 1, where 0 indicates zero out of one hundred requests are logged, and 1 indicates every request is logged. If `head_sampling_rate` is unspecified, it is configured to a default value of 1 (100%). Read more about [head-based sampling](/workers/observability/logs/workers-logs/#head-based-sampling). @@ -1305,6 +1307,29 @@ The following options are available: - `constraints.jurisdiction` - Restrict containers to compliance boundaries. Valid values: `"eu"`, `"fedramp"`. +- `observability` + - Configures observability for this container application when deploying with `wrangler deploy`. + - If omitted, Wrangler uses the top-level [`observability`](#observability) setting as a fallback for that container. + - If set, it overrides the top-level `observability` setting for that container. + +- `observability.enabled` + - Shorthand for `observability.logs.enabled`. + +- `observability.logs.enabled` + - Whether logs for this container are persisted to Cloudflare's observability platform. + +- `observability.target_instance_percentage` + - Apply application-level observability changes to this percentage of running instances. + - Must be an integer from `1` to `99`. + - Cannot be used with `observability.target_instance_count`. + - Requires observability to be enabled for the container. + +- `observability.target_instance_count` + - Apply application-level observability changes to this many running instances. + - Must be a positive integer. + - Cannot be used with `observability.target_instance_percentage`. + - Requires observability to be enabled for the container. + ```jsonc @@ -1315,6 +1340,10 @@ The following options are available: "image": "./Dockerfile", "max_instances": 10, "instance_type": "basic", // Optional, defaults to "lite" + "observability": { + "enabled": true, + "target_instance_percentage": 25, + }, "image_vars": { "FOO": "BAR", },