Last active
August 18, 2021 18:01
-
-
Save infinitewarp/04aeb7c0bbf3d5f24c87f0368ee9e89b to your computer and use it in GitHub Desktop.
crude openshift pod log scraper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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