Today we will be discussing a common query from our customers about being able to route logs from the Delegate pod to the local machine.
To monitor the functioning of the Harness Resources, most customers have a requirement to be able to stream the delegate logs to their endpoint which could be an internal login tool or 3rd party provided ones.
The main concern has been on how we can pull the logs from the K8s pod and push it to out local so we can process it further.
- Since this a log file being which is being pulled with content inside it, you also need to provide the destination as a file inside which the content can be stored. In our case we are logged into the Delegate pod where we create a file called zee.txt with some content.
- We then run the command below in our local
kubectl cp zee-jdomhr-5bdf4:/opt/harness-delegate/zee.txt /home/zeeshan_yousuf/zee-new.txt
- Where the command format ends up being
kubectl cp <pod name>:<path to the file>/zee.txt <destination path>/zee-new.txt
- You can see that the content is picked up as expected on the local machine