Skip to content

Instantly share code, notes, and snippets.

@yuvalif
Last active February 5, 2024 10:59
Show Gist options
  • Save yuvalif/4480eb9bf49df305fa8eba024e7052f3 to your computer and use it in GitHub Desktop.
Save yuvalif/4480eb9bf49df305fa8eba024e7052f3 to your computer and use it in GitHub Desktop.
get logs from teuthology and grep for errors
#!/bin/bash
if [ "$#" -eq 2 ]; then
name=$1
id=$2
cluster="ceph"
endloop=0
elif [ "$#" -eq 3 ]; then
name=$1
id=$2
cluster=$3
endloop=1
else
echo "usage $0 <name> <id> [cluster]"
exit 1
fi
mkdir -p "$name"
cd "$name" ||exit
wget "http://qa-proxy.ceph.com/teuthology/$name/$id/remote/" -O tmp
remotes=$(ag "a href=\"smithi" tmp | cut -d'>' -f 2 | cut -d'<' -f 1)
rm -f tmp
while IFS=$'\n' read -ra remote_list; do
for remote in "${remote_list[@]}"; do
for i in $(seq 0 $endloop); do
logfile=rgw.$cluster.client.$i.log
echo "******************************************************"
echo "fetching $logfile from $remote"
echo "******************************************************"
wget "http://qa-proxy.ceph.com/teuthology/$name/$id/remote/$remote/log/$logfile.gz"
gunzip "$logfile.gz"
ag ERROR "$logfile"
done
done
done <<< "$remotes"
echo "****************************************************************************"
echo "fetching teuthology log"
echo "****************************************************************************"
wget "http://qa-proxy.ceph.com/teuthology/$name/$id/teuthology.log" -O "teuthology$id.log"
ag "... FAIL" "teuthology$id.log" | cut -d':' -f 6-
ag "= FAILURES =" -A 20 "teuthology$id.log"
ag "FAIL: " -A 20 "teuthology$id.log"
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment