This article is intended for NextGen and CurrentGen
Introduction
When debugging a problem, we gather as much information as possible to identify the root cause. Usually, this information is compiled into a log file/log service.
In Harness, all operations go through the Delegate, which is a service that you run on your local network, or VPC, to connect your artifacts, infrastructure, collaboration, verification, and other providers, with the Harness Manager.
After the Delegate is installed, you connect to third-party resources. The Delegate performs all operations, including deployment and integration. For more information about delegates: Delegate overview - Harness.io Docs.
With that in mind, the logs for these operations are concentrated in the delegates, and that’s usually the first place to look when a problem isn’t apparent.
Accessing the logs
The Harness delegate consists of two processes, the Delegate itself and its watcher’ process that handles starting, stopping, and monitoring the Delegate. Logs for both are written to the ./harness-delegate installation directory on the delegate host in delegate.log and watcher.log.
Note: Generally, the default installation folder for delegates is located at /opt/…
The configuration files for the watcher and Delegate are config-watcher.yml and config-delegate.yml.
For containerized delegates, you can extract the log and configuration files into a staging directory with the following commands:
via Docker:
docker cp <container>:/delegate.log ./delegate.log
docker cp <container>:/watcher.log ./watcher.log
docker cp <container>:/config-delegate.yml ./config-delegate.yml
docker cp <container>:/config-watcher.log ./config-watcher.yml
via Kubernetes: (replace namespace and pod names)
kubectl cp <namespace-name>/<pod-name>:/delegate.log ./delegate.log
kubectl cp <namespace-name>/<pod-name>:/watcher.log ./watcher.log
kubectl cp <namespace-name>/<pod-name>:/config-delegate.yml ./config-delegate.yml
kubectl cp <namespace-name>/<pod-name>:/config-watcher.yml ./config-watcher.yml
Archive and compress the files with ‘tar’
tar czvf harness_delegate_logs.tar.z *.log *.yml
Conclusion
If this article cannot resolve your issue, don’t hesitate to contact us here: support@harness.io – or through the Zendesk portal in Harness SaaS.