Observability·续
</details>
<details>
<summary>
Prometheus metrics
</summary>
| Name | Description | Type | Labels |
|---|---|---|---|
| <code>promhttp_metric_handler_requests_in_flight</code> | Current number of scrapes being served. | GAUGE | |
| <code>promhttp_metric_handler_requests_total</code> | Total number of scrapes by HTTP status code. | COUNTER | <code>code</code> |
</details>
<details>
<summary>
Go runtime metrics
</summary>
| Name | Description | Type | Labels |
|---|---|---|---|
| <code>go_gc_duration_seconds</code> | A summary of the pause duration of garbage collection cycles. | SUMMARY | |
| <code>go_goroutines</code> | Number of goroutines that currently exist. | GAUGE | |
| <code>go_info</code> | Information about the Go environment. | GAUGE | <code>version</code> |
| <code>go_memstats_alloc_bytes</code> | Number of bytes allocated and still in use. | GAUGE | |
| <code>go_memstats_alloc_bytes_total</code> | Total number of bytes allocated, even if freed. | COUNTER | |
| <code>go_memstats_buck_hash_sys_bytes</code> | Number of bytes used by the profiling bucket hash table. | GAUGE | |
| <code>go_memstats_frees_total</code> | Total number of frees. | COUNTER | |
| <code>go_memstats_gc_sys_bytes</code> | Number of bytes used for garbage collection system metadata. | GAUGE | |
| <code>go_memstats_heap_alloc_bytes</code> | Number of heap bytes allocated and still in use. | GAUGE | |
| <code>go_memstats_heap_idle_bytes</code> | Number of heap bytes waiting to be used. | GAUGE | |
| <code>go_memstats_heap_inuse_bytes</code> | Number of heap bytes that are in use. | GAUGE | |
| <code>go_memstats_heap_objects</code> | Number of allocated objects. | GAUGE | |
| <code>go_memstats_heap_released_bytes</code> | Number of heap bytes released to OS. | GAUGE | |
| <code>go_memstats_heap_sys_bytes</code> | Number of heap bytes obtained from system. | GAUGE | |
| <code>go_memstats_last_gc_time_seconds</code> | Number of seconds since 1970 of last garbage collection. | GAUGE | |
| <code>go_memstats_lookups_total</code> | Total number of pointer lookups. | COUNTER | |
| <code>go_memstats_mallocs_total</code> | Total number of mallocs. | COUNTER | |
| <code>go_memstats_mcache_inuse_bytes</code> | Number of bytes in use by mcache structures. | GAUGE | |
| <code>go_memstats_mcache_sys_bytes</code> | Number of bytes used for mcache structures obtained from system. | GAUGE | |
| <code>go_memstats_mspan_inuse_bytes</code> | Number of bytes in use by mspan structures. | GAUGE | |
| <code>go_memstats_mspan_sys_bytes</code> | Number of bytes used for mspan structures obtained from system. | GAUGE | |
| <code>go_memstats_next_gc_bytes</code> | Number of heap bytes when next garbage collection will take place. | GAUGE | |
| <code>go_memstats_other_sys_bytes</code> | Number of bytes used for other system allocations. | GAUGE | |
| <code>go_memstats_stack_inuse_bytes</code> | Number of bytes in use by the stack allocator. | GAUGE |
</details>
Diagnostic logs
Cloudflare Tunnel generates diagnostic reports that collect data from a single cloudflared instance running on the local machine. This requires cloudflared version 2024.12.2 or later.
Generate diagnostics
- (Linux only) To include network diagnostics in the logs, allow the
cloudflareduser to create RAW and PACKET sockets without root permissions:
sudo setcap cap_net_raw+ep /usr/bin/traceroute && sudo setcap cap_net_raw+ep /usr/bin/traceroute
```
If you do not set `cap_net_raw`, then traceroute data will be unavailable.
2. Get diagnostic logs:
```sh
cloudflared tunnel diag
```
If multiple instances of `cloudflared` are running on the same host, specify the [metrics server IP and port](#configure-a-custom-address) for the instance you want to diagnose. For example:
```sh
cloudflared tunnel diag --metrics 127.0.0.1:20241
```
This command will output the status of each diagnostic task and place a `cloudflared-diag-YYYY-MM-DDThh-mm-ss.zip` file in your working directory.
<details>
<summary>
Docker diagnostics
</summary>
<code>cloudflared</code> reads diagnostic data from the <a href="#metrics">tunnel metrics server</a>. To get diagnostic logs, the metrics server must be exposed from the Docker container and reachable from the host machine.
1. Determine the <a href="#default-metrics-server-address">metrics server port</a> for the <code>cloudflared</code> instance running in Docker.
2. Ensure the container is deployed with port forwarding enabled. The diagnostic feature will request information from the Docker instance using local port <code>20241</code>, therefore you should forward port <code>20241</code> to the container port obtained in Step 1:
```sh
docker run -d -p 20241:<metrics_port> docker.io/cloudflare/cloudflared tunnel ...
```
3. Verify that you can reach the metrics server address from the Docker host environment:
```sh
curl localhost:20241/diag/tunnel
```
This command should return a JSON:
```json
{
"tunnelID": "ef96b330-a7f5-4bce-a00e-827ce5be077f",
"connectorID": "d236670a-9f74-422f-adf1-030f5c5f0523",
"connections": [
{ "isConnected": true, "protocol": 1, "edgeAddress": "198.41.192.167"},
{"isConnected": true, "protocol": 1, "edgeAddress": "198.41.200.113", "index": 1},
{"isConnected": true, "protocol": 1, "edgeAddress": "198.41.192.47", "index": 2},
{"isConnected": true, "protocol": 1, "edgeAddress": "198.41.200.73", "index": 3}
],
"icmp_sources": ["192.168.1.243", "fe80::c59:bd4a:e815:ed6"]
}
```
4. Run the diagnostic using the local metrics address and Docker container ID:
```sh
cloudflared tunnel diag --metrics localhost:20241 --diag-container-id=<containerID>
```
Alternatively, you can specify the container's name instead of its ID:
```sh
cloudflared tunnel diag --metrics localhost:20241 --diag-container-id=<containerName>
```
If you forwarded a different local port in Step 2, replace <code>20241</code> with that port.
Running the diagnostic command with the container ID allows <code>cloudflared</code> to collect information from the Docker environment such as logs and container details.
This command will output the status of each diagnostic task and place a <code>cloudflared-diag-YYYY-MM-DDThh-mm-ss.zip</code> file in your working directory.
</details>
<details>
<summary>
Kubernetes diagnostics
</summary>
The diagnostic feature will request data from the <a href="#metrics">tunnel metrics server</a> using ports <code>20241</code> to <code>20245</code>. You will need to use port forwarding to allow the local <code>cloudflared</code> instance to connect to the metrics server on one of these ports.
1. Determine the tunnel's <a href="#default-metrics-server-address">metrics server port</a>.
2. Enable port forwarding:
```sh
kubectl port-forward <pod> <diagnostic_port>:<metrics_port>
```
- <code><pod></code>: Name of the pod where the tunnel is running
- <code><diagnostic_port></code> is any local port in the range <code>20241</code> to <code>20245</code>.
- <code><metrics_port></code> is the Kubernetes pod port for the <code>cloudflared</code> instance you want to diagnose (obtained in Step 1).
For example, if you set the metrics server address to <code>0.0.0.0:12345</code>:
```sh
kubectl port-forward cloudflared-6d4897585b-r8kfz 20244:12345
```
Connections made to local port <code>20244</code> are forwarded to port <code>12345</code> of the pod that is running the tunnel.
3. Run the diagnostic:
```sh
cloudflared tunnel diag --diag-pod-id=<podID>
```
If the pod has multiple applications/services running and <code>cloudflared</code> is not the first in the pod, you must specify either the container ID or name:
```sh
cloudflared tunnel diag --diag-pod-id=<podID> --diag-container-id=<containerName>
```
This command will output the status of each diagnostic task and place a <code>cloudflared-diag-YYYY-MM-DDThh-mm-ss.zip</code> file in your working directory.
</details>
### Diagnostic file contents
The `cloudflared-diag-YYYY-MM-DDThh-mm-ss.zip` archive contains the files listed below. The data in a file either applies to the `cloudflared` instance being diagnosed (`diagnosee`) or the instance that triggered the diagnosis (`diagnoser`). For example, if your tunnel is running in a Docker container, the diagnosee is the Docker instance and the diagnoser is the host instance.
| File name | Description | Instance |
| --- | --- | --- |
| `cli-configuration.json` | [Tunnel run parameters](https://developers.cloudflare.com/tunnel/reference/run-parameters/) used when starting the tunnel | diagnosee |
| `cloudflared_logs.txt` | [Tunnel log file](#logs)<sup>[1](#user-content-fn-1)</sup> | diagnosee |
| `configuration.json` | Tunnel configuration parameters | diagnosee |
| `goroutine.pprof` | goroutine profile made available by `pprof` | diagnosee |
| `heap.pprof` | heap profile made available by `pprof` | diagnosee |
| `metrics.txt` | Snapshot of [Tunnel metrics](#metrics) at the time of diagnosis | diagnosee |
| `network.txt` | JSON traceroutes to Cloudflare's global network using IPv4 and IPv6 | diagnoser |
| `raw-network.txt` | Raw traceroutes to Cloudflare's global network using IPv4 and IPv6 | diagnoser |
| `systeminformation.json` | Operating system information and resource usage | diagnosee |
| `task-result.json` | Result of each diagnostic task | diagnoser |
| `tunnelstate.json` | Tunnel connections at the time of diagnosis | diagnosee |
## Footnotes
1. If the log file is blank, you may need to [set `--loglevel` to `debug`](#server-side-logs) when you start the tunnel. The `--loglevel` parameter is only required if you ran the tunnel from the CLI using a `cloudflared tunnel run` command. It is not necessary if the tunnel runs as a Linux/macOS service or runs in Docker/Kubernetes. [↩](#user-content-fnref-1)
Was this helpful?
YesNo
## On this page
[Docs](https://developers.cloudflare.com/)
```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/tunnel/observability/#page","headline":"Observability","description":"Monitor tunnel health, connectors, and connection status.","url":"https://developers.cloudflare.com/tunnel/observability/","inLanguage":"en","image":"https://developers.cloudflare.com/tunnel/observability/og.png?v=b6362e17db073593","dateModified":"2026-10-02","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["Logging"]}
description: Review recent changes to Cloudflare Tunnel. title: Changelog image: https://developers.cloudflare.com/tunnel/platform/changelog/og.png?v=124e22b5c2293a4a
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/tunnel/llms.txt
Use this file to discover all available pages before exploring further.
