Skip to content

Instantly share code, notes, and snippets.

@Oats87
Created December 4, 2018 01:11
Show Gist options
  • Save Oats87/cab6b44f75d1d5dd2250e96490da142b to your computer and use it in GitHub Desktop.
Save Oats87/cab6b44f75d1d5dd2250e96490da142b to your computer and use it in GitHub Desktop.
This grabs the rancher server logs from the pods running and tars them
#!/bin/sh
now=`date +%Y-%m-%d-%H-%M-%S`
for i in $(kubectl get po -n cattle-system | grep "rancher" | awk '{print $1}'); do
echo "Collecting Rancher Logs from: $i"
kubectl logs $i -n cattle-system > cs-$i-$now.log;
done
tar -zcvf rancher-logs-$now.tar.gz cs-*.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment