Add client cli debug (#186)

Add cli debug command and update outputs
This commit is contained in:
Viktor Liu
2024-05-15 18:09:29 +02:00
committed by GitHub
parent 6d43cb9dc2
commit 493803e20c
5 changed files with 263 additions and 28 deletions

View File

@@ -21,9 +21,12 @@ Peers detail:
Direct: true
ICE candidate (Local/Remote): host/host
ICE candidate endpoints (Local/Remote): 10.128.0.35:51820/10.128.0.54:51820
Last connection update: 2024-01-30 08:52:51
Last Wireguard handshake: 2024-01-30 10:58:13
Last connection update: 20 seconds ago
Last Wireguard handshake: 19 seconds ago
Transfer status (received/sent) 6.1 KiB/20.6 KiB
Quantum resistance: false
Routes: 10.0.0.0/24
Latency: 37.503682ms
server-b.netbird.cloud:
NetBird IP: 100.75.226.48/32
@@ -34,20 +37,28 @@ Peers detail:
Direct: false
ICE candidate (Local/Remote): relay/host
ICE candidate endpoints (Local/Remote): 108.54.10.33:60434/10.128.0.12:51820
Last connection update: 2024-01-30 08:52:51
Last Wireguard handshake: 2024-01-30 10:58:13
Last connection update: 20 seconds ago
Last Wireguard handshake: 18 seconds ago
Transfer status (received/sent) 6.1 KiB/20.6 KiB
Quantum resistance: false
Routes: -
Latency: 37.503682ms
Daemon version: 0.25.5
CLI version: 0.25.5
OS: darwin/amd64
Daemon version: 0.27.4
CLI version: 0.27.4
Management: Connected to https://api.netbird.io:443
Signal: Connected to https://signal.netbird.io:443
Relays:
[stun:turn.netbird.io:5555] is Available
[turns:turn.netbird.ioo:443?transport=tcp] is Available
Nameservers:
[8.8.8.8:53, 8.8.4.4:53] for [.] is Available
FQDN: maycons-mbp-2.netbird.cloud
NetBird IP: 100.75.143.239/16
Interface type: Kernel
Quantum resistance: false
Routes: -
Peers count: 2/2 Connected
```
As you can see, the output shows the peers connected, the NetBird IP address, the public key, the connection status, and the connection type.
@@ -63,14 +74,62 @@ As for Peers, the status will show the following information:
See more details about the status command [here](/how-to/cli#status).
## Getting client logs
By default, client logs are located in the `/var/log/netbird/client.log` folder on macOS and Linux and in the `C:\ProgramData\netbird\client.log` folder on Windows.
By default, client logs are located in the `/var/log/netbird/client.log` file on macOS and Linux and in the `C:\ProgramData\netbird\client.log` file on Windows.
You can analyze the logs to identify the root cause of the problem. If you need help, open a [github issue](https://github.com/netbirdio/netbird/issues/new/choose) and attach the logs.
### Debug bundle
A debug archive containing the recent logs and the status at the time of execution can be generated with the following command.
Adding the `-A` flag will anonymize the logs, removing sensitive information such as public IP addresses and domain names.
```shell
netbird debug bundle -A
```
This will output the path of the generated file, which can be accesses with administrative privileges.
### Debug for a specific time
To capture logs for a specific time, you can use the `debug for` command. This will generate a debug bundle after the specified time has elapsed.
```shell
netbird debug for 5m -A
```
To capture any issues arising during a full `up`/`down` cycle, this will bring netbird `down`, set the log level to `trace`, and bring it back `up`.
After 5 minutes netbird will be brought down again and the debug bundle will be generated.
<Note>
Netbird won't be automatically brought back up after the debug bundle is generated.
</Note>
## Enabling debug logs on agent
Logs can be temporarily set using the following command.
```shell
netbird debug log level debug
````
or
```shell
netbird debug log level trace
```
The next time the daemon is restarted, the log level will return to the configured level.
Using `netbird down` and `netbird up` will not reset the log level.
To permanently set the log level, see the following sections.
### On Linux with systemd
The default systemd unit file reads a set of environment variables from the path `/etc/sysconfig/netbird`. You can add the following line to the file to enable debug logs:
The default systemd unit file reads a set of environment variables from the path `/etc/sysconfig/netbird`.
You can add the following line to the file to enable debug logs:
```shell
sudo mkdir -p /etc/sysconfig