aboutsummaryrefslogtreecommitdiff
path: root/tests/check-logs.sh
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2019-04-03 12:08:21 +0100
committerMark Goddard <mark@stackhpc.com>2019-08-16 15:33:54 +0000
commita14eee24d17cdc967190a6fd5fa55762c11db78f (patch)
tree89283a7dd50c79bb25c34a84bd5839ac683037c4 /tests/check-logs.sh
parent4468250b951ed4a95942ec58be361fd74c809a99 (diff)
downloadkolla-ansible-a14eee24d17cdc967190a6fd5fa55762c11db78f.tar.gz
kolla-ansible-a14eee24d17cdc967190a6fd5fa55762c11db78f.zip
Check for CRITICAL, WARNING and ERROR log messages in CI
At the end of a CI run, check all log files. Change-Id: I99afc1c5207757e35beabf7daebd86c56151c96d
Diffstat (limited to 'tests/check-logs.sh')
-rwxr-xr-xtests/check-logs.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/check-logs.sh b/tests/check-logs.sh
new file mode 100755
index 000000000..614a5ed00
--- /dev/null
+++ b/tests/check-logs.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Check for CRITICAL, ERROR or WARNING messages in log files.
+
+set -o errexit
+
+# Enable unbuffered output for Ansible in Jenkins.
+export PYTHONUNBUFFERED=1
+
+
+for level in CRITICAL ERROR WARNING; do
+ all_file=/tmp/logs/kolla/all-${level}.log
+ any_matched=0
+ any_critical=0
+ echo "Checking for $level log messages"
+ for f in $(sudo find /var/log/kolla/ -type f); do
+ if sudo egrep "^.* .* .* $level" $f >/dev/null; then
+ any_matched=1
+ if [[ $level = CRITICAL ]]; then
+ any_critical=1
+ fi
+ echo $f >> $all_file
+ sudo egrep "^.* .* .* $level" $f >> $all_file
+ echo >> $all_file
+ fi
+ done
+ if [[ $any_matched -eq 1 ]]; then
+ echo "Found some $level log messages. Matches in $all_file"
+ fi
+done
+
+if [[ $any_critical -eq 1 ]]; then
+ echo "Found critical log messages - failing job."
+ exit 1
+fi