How to get Instana agent logs for a Kubernetes namespace

Problem:

Agent logs are required to assist with an troubleshooting an issue related to Kubernetes.

 

Solution:

Please use the attached script to get the logs of all instana-agents in your cluster. It will output all logs in directory "instana-agent-logs" which can be zipped and sent to Support.

Content of script is below:

mkdir instana-agent-logs
for p in $(kubectl get pods --namespace instana-agent | cut -f 1 -d ' '); do
if [[ $p != "NAME" ]]
then
kubectl logs $p -c instana-agent --namespace instana-agent > instana-agent-logs/$p-instana-agent.log
kubectl logs $p -c instana-agent-leader-elector --namespace instana-agent > instana-agent-logs/$p-instana-agent-leader-elector.log

fi
done

Have more questions? Submit a request

Comments