How to Collect Delegate Logs from a Harness Delegate
Harness is a Continuous Delivery as a Service platform that provides a unified solution for deploying and managing applications in different environments. Harness uses Harness Delegates to perform deployments in the target environments. Harness Delegates are lightweight agents that run on servers in the target environments and communicate with the Harness Manager to perform deployments.
Sometimes, you might need to collect the logs generated by a Harness Delegate to troubleshoot issues or monitor the Delegate’s activity. In this article, we will explain how to collect Delegate logs from a Harness Delegate.
Before you start collecting Delegate logs, you need to make sure that you have the following prerequisites:
- A Harness account with at least one Delegate registered in an environment.
- Access to the Delegate machine or pod where you want to collect logs.
Steps to Collect Delegate Logs
Follow these steps to collect Delegate logs from a Harness Delegate Machine:
- Open your preferred SSH client and connect to the Delegate machine or Delegate Pod (if you have a Kubernetes Delegate), where you want to collect logs. You will need to use the SSH credentials for the machine to log in.
- Once you are logged in, navigate to the log directory for the Harness Delegate. By default, the log directory for a Harness Delegate is located at
/opt/harness-delegate. You can navigate to this directory by running the following command:
- Once you are in the Delegate log directory, you can see the log files generated by the Delegate. The log files are named
(date)is the date when the log was generated in the format
YYYY-MM-DD. For example, a log file for April 11, 2023 would be named
- You can view the contents of the log file by running the
catcommand followed by the log file name. For example, to view the contents of the
delegate.2023-04-11.logfile, run the following command:
This will display the contents of the log file in the terminal.
- If you want to download the log file to your local machine for further analysis, you can use the
scpcommand. For example, to download the
delegate.2023-04-11.logfile to your local machine’s Downloads directory, run the following command:
scp user@delegate-machine:/opt/harness-delegate/delegate.2023-04-11.log ~/Downloads/
user with the username for the SSH connection and
delegate-machine with the hostname or IP address of the Delegate machine. This command will copy the
delegate.2023-04-11.log file from the Delegate machine to the
Downloads directory on your local machine.
- Once you have collected the log files, you can analyze them using your preferred log analysis tool. This can help you troubleshoot issues and monitor the Delegate’s activity.
In this article, we explained how to collect Delegate logs from a Harness Delegate. Harness Delegates play a critical role in the deployment process, and collecting their logs can help you troubleshoot issues and monitor their activity. By following the steps outlined in this article, you can easily collect Delegate logs from the Harness Manager UI or directly from the Delegate machine.
We hope this article helps you in your Harness journey. If you have any feedback or questions, feel free to reach out to us in the comments below.