Skip to content

Instantly share code, notes, and snippets.

@portante
Created May 12, 2017 19:55
Show Gist options
  • Select an option

  • Save portante/d118053db7bc385a0d0e86e47578ed74 to your computer and use it in GitHub Desktop.

Select an option

Save portante/d118053db7bc385a0d0e86e47578ed74 to your computer and use it in GitHub Desktop.
Simple bash script to get the logs of all the logging component pods with timestamps
#!/bin/bash
function fetchlogs {
if [ $1 = "kibana" ]; then
_container="-c kibana"
else
_container=""
fi
for i in $(oc get pods --output=name -l component=$1 | sed 's|pod/||') ; do oc logs $i $_container > $i.$2.log ; done
}
_TS=$(date +"%Y%m%d%H%M%S")
for j in es kibana curator fluentd ; do
fetchlogs $j $_TS
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment