|
1 | 1 | --- |
2 | 2 | pcx_content_type: reference |
3 | | -title: Logs |
| 3 | +title: Log streaming |
4 | 4 | sidebar: |
5 | 5 | order: 1 |
6 | 6 | head: |
7 | 7 | - tag: title |
8 | | - content: Tunnel logs |
| 8 | + content: Tunnel log streams |
9 | 9 | --- |
10 | 10 |
|
11 | 11 | Tunnel logs record all activity between a `cloudflared` instance and Cloudflare's global network, as well as all activity between `cloudflared` and your origin server. These logs allow you to investigate connectivity or performance issues with a Cloudflare Tunnel. You can configure your server to store persistent logs, or you can stream real-time logs from any client machine. |
12 | 12 |
|
13 | 13 | ## View logs on the server |
14 | 14 |
|
15 | | -If you have access to the origin server, you can enable logging when you start the tunnel: |
| 15 | +If you have access to the origin server, you can use the [`--loglevel` flag](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-run-parameters/#loglevel) to enable logging when you start the tunnel. By default, `cloudflared` prints logs to stdout and does not store logs on the server. You can optionally use the [`--logfile` flag](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-run-parameters/#logfile) to write your logs to a file. |
16 | 16 |
|
17 | | -```sh |
18 | | -cloudflared tunnel --loglevel debug run <UUID> |
19 | | -``` |
20 | | - |
21 | | -The [`--loglevel` flag](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-run-parameters/#loglevel) indicates the logging level for the local `cloudflared` instance, which can be one of {`debug`, `info`, `warn`, `error`, `fatal`} (default: `info`). At the `debug` level, `cloudflared` will log and display the request URL, method, protocol, content length, as well as all request and response headers. However, note that this can expose sensitive information in your logs. |
22 | | - |
23 | | -### Write logs to file |
24 | | - |
25 | | -By default, `cloudflared` prints logs to stdout and does not store logs on the server. You can use the [`--logfile` flag](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-run-parameters/#logfile) to save your logs to a file: |
| 17 | +To enable logs for a locally-managed tunnel: |
26 | 18 |
|
27 | 19 | ```sh |
28 | | -cloudflared tunnel --logfile mytunnel.log run <UUID> |
| 20 | +cloudflared tunnel --loglevel debug --logfile cloudflared.log run <UUID> |
29 | 21 | ``` |
30 | 22 |
|
| 23 | +To enable logs for a remotely-managed tunnel, add `--loglevel debug` and `--logfile <PATH>` to your system service as shown in [Add tunnel run parameters](/cloudflare-one/connections/connect-networks/configure-tunnels/remote-management/#add-tunnel-run-parameters). |
| 24 | + |
31 | 25 | ## View logs on your local machine |
32 | 26 |
|
33 | | -You can view real-time logs for a Cloudflare Tunnel via the dashboard or from any machine that has `cloudflared` installed. With remote log streams, you do not need to SSH into the server that is running the tunnel. |
| 27 | +You can view real-time logs for a Cloudflare Tunnel via the dashboard or from any machine that has `cloudflared` installed. With remote log streams, you do not need to SSH into the server that is running the tunnel. To get remote logs, the tunnel must be active and able to receive requests. |
34 | 28 |
|
35 | 29 | ### Dashboard |
36 | 30 |
|
37 | | -#### Prerequisites |
| 31 | +Dashboard log streams are only available for remotely-managed tunnels. To view logs from the dashboard: |
38 | 32 |
|
39 | | -- `cloudflared` version 2023.5.1 or higher is installed on the origin server. |
40 | | -- The tunnel is active and able to receive requests. |
41 | | - |
42 | | -#### View logs |
43 | | - |
44 | | -1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **Networks** > **Tunnels** and select your tunnel. |
| 33 | +1. In [Zero Trust](https://one.dash.cloudflare.com/), go to **Networks** > **Tunnels** and select a remotely-managed tunnel. |
45 | 34 | 2. In the sidebar, select the **Connector ID** for the `cloudflared` instance you want to view. |
46 | 35 | 3. Select **Begin log stream**. |
47 | 36 |
|
48 | 37 | ### CLI |
49 | 38 |
|
50 | | -The `cloudflared` daemon can stream logs from any tunnel in your account to the local command line. |
51 | | - |
52 | | -#### Prerequisites |
53 | | - |
54 | | -- `cloudflared` version 2023.5.1 or higher is installed on both your local machine and the origin server. |
55 | | -- The tunnel is active and able to receive requests. |
| 39 | +The `cloudflared` daemon can stream logs from any tunnel in your account to the local command line. `cloudflared` must be installed on both your local machine and the origin server. |
56 | 40 |
|
57 | 41 | #### View logs |
58 | 42 |
|
|
0 commit comments