for container in `kubectl get pods -n osm | grep -v operator | grep -v NAME| awk '{print $1}'`; do
logfile=`echo $container | cut -d- -f1`
echo "Extracting log for $logfile"
- kubectl logs -n osm $container 2>&1 > logs/$logfile.log
+ kubectl logs -n osm $container --timestamps=true 2>&1 > logs/$logfile.log
done
'''
} else {
sshCommand remote: remote, command: '''
for deployment in `kubectl -n osm get deployments | grep -v operator | grep -v NAME| awk '{print $1}'`; do
echo "Extracting log for $deployment"
- kubectl -n osm logs deployments/$deployment --all-containers 2>&1 > logs/$deployment.log
+ kubectl -n osm logs deployments/$deployment --timestamps=true --all-containers 2>&1 > logs/$deployment.log
done
'''
sshCommand remote: remote, command: '''
for statefulset in `kubectl -n osm get statefulsets | grep -v operator | grep -v NAME| awk '{print $1}'`; do
echo "Extracting log for $statefulset"
- kubectl -n osm logs statefulsets/$statefulset --all-containers 2>&1 > logs/$statefulset.log
+ kubectl -n osm logs statefulsets/$statefulset --timestamps=true --all-containers 2>&1 > logs/$statefulset.log
done
'''
}
}
}
} finally {
- stage("Archive Contailer Logs") {
+ stage("Archive Container Logs") {
// Archive logs to containers_logs.txt
archive_logs(remote)
if ( ! currentBuild.result.equals('UNSTABLE') && ! currentBuild.result.equals('FAILURE')) {