Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
crude openshift pod log scraper
#!zsh
# get all current cloudigrade pods logs
PROJECT="cloudigrade-stage"
#PROJECT="cloudigrade-prod"
#PROJECT="cloudigrade-ci"
oc project "${PROJECT}" || exit $?
DATEDIR=$(gdate -u "+%Y-%m-%dT%H.%M.%S")
DIRNAME="logs-$PROJECT-$DATEDIR"
mkdir -p "${DIRNAME}"
pushd "${DIRNAME}"
for POD in $(oc get pods -o jsonpath='{.items[?(.status.phase=="Running")].metadata.name}'); do
oc logs "${POD}" > "${POD}.txt"
done
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment