Incorporate the external log files in debug ball
- don't put bash command errors in log files
- add exit on fail option to repeat script
- add ability of repeat script to include external logs
diff --git a/scripts/log-collector.sh b/scripts/log-collector.sh
index b99d7d9..6577631 100755
--- a/scripts/log-collector.sh
+++ b/scripts/log-collector.sh
@@ -54,10 +54,13 @@
NS=$(echo $POD | cut -d: -f1)
POD=$(echo $POD | cut -d: -f2 | sed -e 's/^pod\///g')
echo " $POD"
- kubectl logs --timestamps=true $SINCE_FLAG -n $NS --all-containers $LOG_ARGS $POD 2>&1 > $WORK/$POD.log
+ kubectl logs --timestamps=true $SINCE_FLAG -n $NS --all-containers $LOG_ARGS $POD 2>/dev/null > $WORK/$POD.log
if [ $? -ne 0 ]; then
echo " ERROR: Encountered while getting POD log, removing failed entry"
rm -f $WORK/$POD.log
+ elif [ $(cat $WORK/$POD.log | wc -l) -eq 0 ]; then
+ # empty
+ rm -f $WORK/$POD.log
fi
done
if [ $(ls -1 $WORK/ | wc -l) -eq 0 ]; then