How to View cloudSwXtch Logs for Troubleshooting

Prev Next
WHAT TO EXPECT
In this article, users will learn about accessing cloudSwXtch logs for the purpose of troubleshooting. We will break down two commands: swx support and sudo journalctrl. Common arguments that can be used when compiling information for the support team at swXtch.io will also be discussed.

Support may also request for you to send xNIC logs. For more information, see How to Find xNIC Logs.

swx support Logs 

When troubleshooting, swXtch.io Support will request a report detailing the statistical data stored within the cloudSwXtch during a certain period. This report will include max highmarks, list highmarks, logs, swxtch Info, xNIC Logs, License and Config --  all in a compressed tar.gz file. 

Accessing the Report

The following command will compile the data stored on the disk between a certain time period by executing all other commands, saving it in a compressed file. 

./swx support -f "yyyy-mm-dd" -t "yyyy-mm-dd"  -s localhost

An example output file would be swxtch-report-2024-05-22_15-58-55.tar.gz.

Alternatively, you can export swx support logs using the wXcked Eye UI. To learn more, see the wXcked Eye Support Page article. 

Available swx support Arguments

Exporting only xNIC Logs (xnic-logs)

Users can export xNIC logs by specifying it with the swx support command. In addition to the xnic-logs command, they must use the argument --xnic and specify the xNIC's control IP. In the example below, the xNIC's control IP is 10.5.1.4. 

Example

./swx support xnic-logs -since 2h -s localhost --xnic 10.5.1.4

An example output file would be xnicLogs-10.5.1.4-2024-05-22_20-27-55.tar.gz

Date from (-f) and date to (-t)

  • Following the -f (date_from), enter the starting date. 
  • Following the -t (date_to), enter the end date.
  • Both dates can also include the time, using the ISO 8601 date format (Example: 2006-01-02T15:04:05Z)

Please note: Both "From" and "to" are optional. If nothing is set, the default is over the past 7 days

Since hours/days (--since)

Following -since, users can specify number of days (d) or hours (h). For example, if a user would like to get logs since 8 hours ago, they would specify -since 8h. If they would like 4 days ago, they would specify -since 2d.  

Example: 

Hours 
$ ./swx support -s localhost --since 8h

Days
$ ./swx support -s localhost --since 2d

Core dumps (--dump)

Add -dump if you wish to include the core dumps in the report. 

Help (-h) for additional commands

Add a -h to the command if you wish to see an extensive list of available commands. For example, you can specify a certain section of the report to export as a tar.gz file, similar to the xNIC logs example above. 

Example

root@dsd-core-200:/swxtch# ./swx support -h
Swxtch support tool
 
Usage:
  swx support [flags]
  swx support [command]
 
Available Commands:
  bridge-log     Bridge log file
  list-highmarks List highmarks metrics within time range
  logs           Logs
  max-highmarks  Max highmarks metrics
  swxtch-info    Swxtch Info
  xnic-logs      xNIC logs file
 
Flags:
  -b, --bridge string                 bridge address
  -f, --date-from string              Date from
  -t, --date-to string                Date to
  -d, --dump                          Dump enable
  -h, --help                          help for support
  -o, --path string                   Path location
  -s, --service-host-address string   Host swxtch address in the form <host>[:port] (default "localhost")
  -c, --since string                  Since
  -x, --xnic string                   xnic
 
Use "swx support [command] --help" for more information about a command.

cloudSwXtch Service Logs

In addition to the swx support logs, swXtch.io Support might request logs for the -ctrl/-repl services. For log requests, the standard command, sudo journalctl -u, can used with either swxtch-ctrl.service or swxtch-repl.service to get a detailed breakdown of cloudSwXtch activity. 

  • swxtch-ctrl.service - This will display information regarding the cloudSwXtch's control plane. 
  • swxtch-repl.service - This will display information regarding the cloudSwXtch's replicator app that is on the data plane. 

In addition, the log request command can be used for swxtch-bridge2 (Bridge Type 2) and swXtch-bridge (Bridge Type 1) for bridge-related logs.

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 up until now.

Users can use any combination of the arguments below to create their logs. 

Accessing and Following Logs (-f)

The following command will begin to display logs for either the swxtch-ctrl or swxtch-repl service at the time of the request. The -f argument will follow the logs and continually update. Logs prior to the call will not display. 

sudo journalctl -u <swxtch-ctrl.service OR swxtch-repl.service> -f

Note: A user will need to choose between swxtch-ctrl or swxtch-repl. The .service is not necessary and will work with or without.

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

The following argument can be used to list a specific number of lines in a log. 

sudo journalctl -u <swxtch-ctrl OR swxtch-repl> -n <number of lines>

Example

sudo journalctl -u swxtch-repl -n 200

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

The following command will display logs within a set timeframe (between 2 dates). 

sudo journalctl - u <swxtch-ctrl or swxtch-repl> --since <yyyy-mm-dd> --until <yyyy-mm-dd>

Example

sudo journalctl - u swxtch-repl --since 2023-03-07 --until 2023-03-10 

--since "Yesterday", "today", "now"

You can also use the words "yesterday," "today" or "now" after --since to get logs from that time period. 

sudo journalctl - u swxtch-repl --since yesterday

Displaying Logs since Last Boot (-b)

To display logs since last boot, users can use the -b argument. 

sudo journalctl -u <swxtch-ctrl OR swxtch-repl> -b

List boots (--list-boot)

The following argument can be used to list all the boots in date/time order. 

sudo journalctl -u <swxtch-ctrl OR swxtch-repl> --list-boot

Exporting Logs (>)

The following command will export your logs to a .txt file. Logs should be emailed to support@swxtch.io

sudo journalctl - u <swxtch-ctrl or swxtch-repl> > <file-name>.txt

Example: 

sudo journalctl - u swxtch-repl > cloudswxtch-test.txt

You can also combine arguments to export logs from a timeframe or from last boot. It is recommended that logs should cover 24 hours worth of time, starting from before the issue to up until now. 

Example:

LAST BOOT: 
sudo journalctl - u swxtch-ctrl -b > cloudswxtch-test.txt

TIMEFRAME: 
sudo journalctl - u swxtch-repl --since 2023-03-07 --until 2023-03-10 > cloudswxtch-test.txt 

Change Logs to UTC (--utc)

To switch logs from local time to UTC, use the following argument: 

sudo journalctl --utc