How to View cloudSwXtch and swXtchBridge Logs using shell

Prev Next

WHAT TO EXPECT

In this article, users will learn how to view logs in both cloudSwXtch and swXtchBridge VMs using shell commands.

Getting logs from a container can be done in several ways. In the next examples, you can use either swx-bridge or swx-swxtch depending on the desired log. But the commands will be the same. For example, to get the bridge logs, the commands can be:

  1. docker logs swx-bridge

  2. sudo journalctl -t swx-bridge

  3. journalctl CONTAINER_NAME=swx-bridge

Even if the commands will read the same logs, they are not the same because they are different ways of accessing the log. There are also differences in the output. For example, by default, the first command using docker won’t print a timestamp:

info: launcher.go:39: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 Bootstrap.cpp[34]: swx-tunnel App: packet proxy tunnel interface 'swx0-tun' (index: 6).
swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 ControlServer.cpp[51]: Starting swx-tunnel App's Control (RPC) Server...
info: launcher.go:39: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 RpcServer.cpp[102]: Rpc server listening on 127.0.0.1:10004
swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 PktProxy.cpp[293]: Starting swx-tunnel App's Packet Proxy...
swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[151]: Cgroup directory already exists: "/sys/fs/cgroup/swx-protocol"
info: launcher.go:39: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[170]: Moved PID 64 into "/sys/fs/cgroup/swx-protocol/cgroup.procs"
info: launcher.go:39: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[187]: There are not isolated cpus, defaulting to all available CPUs
swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[216]: Applied cpuset.mems=0 to "/sys/fs/cgroup/swx-protocol"
swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[252]: Restricted to CPUs 0-3 in "/sys/fs/cgroup/swx-protocol"
swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[274]: Applied CPU limit of 80% per CPU (4 CPUs, quota=320000 100000) to "/sys/fs/cgroup/swx-protocol"
info: launcher.go:39: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[337]: Final cgroup content for "/sys/fs/cgroup/swx-protocol": procs=2 entries, threads=18 entries, cpuset.mems=0, cpuset.cpus=0-3
swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 PktProxy.cpp[110]: Packet's dest. IP 156.104.12.255 doesn't map to a known MAC address. Ignoring packet.
info: launcher.go:45: Could not set default mac for protocol swx-tunnel. Retrying...
info: launcher.go:39: swx-tunnel: Dec 04 15:26:00 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 ControlServer.cpp[24]: Handling Set Default Mac Message
info: launcher.go:69: Default mac has been set for protocol swx-tunnel

The same log using systemctl will give:

Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: info: launcher.go:39: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[170]: Moved PID 64 into "/sys/fs/cgroup/swx-protocol/cgroup.procs"
Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: info: launcher.go:39: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[187]: There are not isolated cpus, defaulting to all available CPUs
Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[216]: Applied cpuset.mems=0 to "/sys/fs/cgroup/swx-protocol"
Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[252]: Restricted to CPUs 0-3 in "/sys/fs/cgroup/swx-protocol"
Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[274]: Applied CPU limit of 80% per CPU (4 CPUs, quota=320000 100000) to "/sys/fs/cgroup/swx-protocol"
Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: info: launcher.go:39: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 thread.cpp[337]: Final cgroup content for "/sys/fs/cgroup/swx-protocol": procs=2 entries, threads=18 entries, cpuset.mems=0, cpuset.cpus=0-3
Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: swx-tunnel: Dec 04 15:25:59 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 PktProxy.cpp[110]: Packet's dest. IP 156.104.12.255 doesn't map to a known MAC address. Ignoring packet.
Dec 04 15:26:00 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: info: launcher.go:45: Could not set default mac for protocol swx-tunnel. Retrying...
Dec 04 15:26:00 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: info: launcher.go:39: swx-tunnel: Dec 04 15:26:00 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal #64 ControlServer.cpp[24]: Handling Set Default Mac Message
Dec 04 15:26:00 fs-c42-br01.us-central1-f.c.swxtch-sa-project.internal swx-bridge[1302]: info: launcher.go:69: Default mac has been set for protocol swx-tunnel

It is recommended for users to send logs from both services to support@swxtch.io. The logs should cover 24 hours’ worth of time, starting from before the issue to the present.

PLEASE NOTE

It is recommended to read journalctl documentation from its man page.

PLEASE NOTE

To find the logs, use the following file path:

/var/log/swxtch

PLEASE NOTE

Using wXcked Eye, users can get the logs and even more useful information that will help troubleshooting and analyzing. Please, read the Support page under wXcked Eye swXtch Management.

Below are several useful arguments that can filter the logs. Users can use any combination of them to create the desired output. These arguments can be used on any of the commands given above, except for the English words for time references that can’t be used with the docker command. But the examples will use only the sudo journalctl command.

Following Logs (-f)

The -f argument will (F)ollow the logs and continually update. Logs prior to the call will not display. 

sudo journalctl -t swx-swxtch.service -f

NOTE

The .service is not necessary and will work with or without.

Listing a Certain Number of Lines in a Log (-n)

The -n argument can be used to list a specific (N)umber of lines in a log, starting from the earliest, and with the ability to scroll down if the number of lines is greater than what the console can show using cursor keys:

sudo journalctl -t swx-swxtch.service -n <number of lines>

Displaying Logs within a Timeframe (--since --until)

The --since and --until command will display logs within a set timeframe (between 2 dates or time references):

sudo journalctl -t swx-swxtch.service --since <Time-Reference-1> --until <Time-Reference-2>

Where <Time-Reference-X> can be a date or a keyword:

  • YYYY-MM-DD HH:MM:SS (can be used with date only or time only)

  • yesterday (Midnight (00:00) of the previous day)

  • today (Midnight (00:00) of the current day)

  • now (The current moment)

  • ago (Relative times using the word ago, like "1 hour ago", "2 days ago", "30 minutes ago")

Example 1:

sudo journalctl -t swx-swxtch --since 2025-10-07 --until 2025-10-08 

Example 2:

sudo journalctl -t swx-swxtch --since "yesterday" --until "1 hour ago"

Displaying Logs since Last Boot (-b)

The -b argument will display logs since the last (B)oot:

sudo journalctl -t swx-swxtch -b

List boots (--list-boot)

The --list-boot argument can be used to list all the boots in date/time order: 

sudo journalctl -t swx-swxtch --list-boot

Change Logs to UTC (--utc)

The --utc argument switch logs from local time to UTC:

sudo journalctl --utc

Exporting Logs (>)

Users can use the shell output redirector (character >) to send the output of any command to a file, putting the filename right after the character. The following command will export the log to a .log file.

sudo journalctl -t swx-swxtch > <file-name.log>

Example: 

sudo journalctl -t swx-swxtch > cloudswxtch-service.log

Arguments can also be combined to export logs from a timeframe or from the last boot. It is recommended that logs should cover at least 24 hours’ worth of time, starting from before the issue until the present.

Example:

LAST BOOT: 
sudo journalctl -t swx-swxtch -b > cloudswxtch-service.log

TIMEFRAME: 
sudo journalctl -t swx-swxtch --since 2 days ago --until 1 hour ago > cloudswxtch-service.log