Twingate Technical Support will often request Twingate Connector debug level logs to troubleshoot reported issues. As debug level logs are extremely busy for the Twingate Connector, error level logging is configured by default.
The below process will cover how to enable debug logging across the various deployment methods and how to collect the logs to provide to Twingate Technical Support.
The process for enabling debug level logs and collecting the logs will depend on the Twingate Connector deployment method. The two methods will be containerized or systemd deployments and the applicable steps are broken down by deployment method below.
If you are using the Twingate systemd service, for example, if using our AMI deployment process, you need to add the TWINGATE_LOG_LEVEL variable to the Connector configuration file before restarting the service. Follow the below steps to do so.
TWINGATE_LOG_LEVEL=7 to the /etc/twingate/connector.conf file:
echo "TWINGATE_LOG_LEVEL=7" | sudo tee -a /etc/twingate/connector.conf
sudo systemctl restart twingate-connector
/tmp/<hostname>_<timestamp>.log.gz, where ts=$(date -d "today" +"%Y%m%d%H%M") && sudo journalctl --utc -u twingate-connector | tee /tmp/$(hostname -s)_$ts.log && sudo gzip /tmp/$(hostname -s)_$ts.log
sudo sed -i '/TWINGATE_LOG_LEVEL=7/d' /etc/twingate/connector.conf && sudo systemctl restart twingate-connector
If you are using Docker or another container service, you need to set the TWINGATE_LOG_LEVEL environment variable and redeploy the container. TWINGATE_LOG_LEVEL should be set to the value 7 to enable debug logs.
For example, in a Docker run command, adding --env TWINGATE_LOG_LEVEL=7 will enable debug logging. Further specific deployment instructions are below.
Enable debug level logging
For existing Docker containers you can use the below script on the Docker host to enable debug level logging. It will set the environmental variable TWINGATE_LOG_LEVEL=7 to the existing variables and start a new container instance with the previous container configurations.
curl -s https://binaries.twingate.com/connector/docker-change-log-level.sh | sudo bash -s 7
Export Twingate Connector logs to file
After sufficient time or reproducing the issue on the applicable Twingate Connector, run the below command to export the Twingate Connector logs to a compressed file. To save logs from a Docker container, run the below command to save all logs to the current directory:
cont=&& ts=$(date -d "today" +"%Y%m%d%H%M") && sudo docker logs -t $cont 2>&1 | sudo tee $cont_$ts.log && sudo gzip $cont_$ts.log
Note: Replace with the Docker container ID or name. Additionally,2>&1 is required in the command above to save the full logging output from Docker.
Disable debug level logging (restore to Error level)
Note: It is best practice to disable debug level logging when not actively troubleshooting Twingate Connector issues. Debug level logging left in place long term can result in unnecessary log disk utilization. In order to disable debug level logging, run the below command.
curl -s https://binaries.twingate.com/connector/docker-change-log-level.sh | sudo bash
TWINGATE_LOG_LEVEL=7 to the Twingate Connector deployment YAML.az container logs --resource-group --name
TWINGATE_LOG_LEVEL=7 to the Twingate Connector deployment YAML.