@@ -29,6 +29,75 @@ function check_fluentd_log_file_for_content {
29
29
sudo egrep " $2 " $1
30
30
}
31
31
32
+ function check_fluentd_missing_logs {
33
+ code=0
34
+ for file in $( sudo find /var/log/kolla/ -type f -name ' *.log' | grep -v ' ^$' ) ; do
35
+ case $file in
36
+ /var/log/kolla/ansible.log)
37
+ continue
38
+ ;;
39
+ /var/log/kolla/etcd/etcd.log)
40
+ continue
41
+ ;;
42
+ /var/log/kolla/fluentd/fluentd.log)
43
+ continue
44
+ ;;
45
+ /var/log/kolla/glance-tls-proxy/glance-tls-proxy.log)
46
+ continue
47
+ ;;
48
+ /var/log/kolla/grafana/grafana.log)
49
+ continue
50
+ ;;
51
+ /var/log/kolla/haproxy/* )
52
+ continue
53
+ ;;
54
+ /var/log/kolla/ironic/dnsmasq.log)
55
+ continue
56
+ ;;
57
+ /var/log/kolla/mariadb/mariadb-bootstrap.log)
58
+ continue
59
+ ;;
60
+ /var/log/kolla/mariadb/mariadb-clustercheck.log)
61
+ continue
62
+ ;;
63
+ /var/log/kolla/mariadb/mariadb-upgrade.log)
64
+ continue
65
+ ;;
66
+ /var/log/kolla/neutron/dnsmasq.log)
67
+ continue
68
+ ;;
69
+ /var/log/kolla/neutron-tls-proxy/neutron-tls-proxy.log)
70
+ continue
71
+ ;;
72
+ /var/log/kolla/opensearch/* )
73
+ continue
74
+ ;;
75
+ /var/log/kolla/opensearch-dashboards/* )
76
+ continue
77
+ ;;
78
+ /var/log/kolla/openvswitch/* )
79
+ continue
80
+ ;;
81
+ /var/log/kolla/proxysql/proxysql.log)
82
+ continue
83
+ ;;
84
+ /var/log/kolla/rabbitmq/* upgrade.log)
85
+ continue
86
+ ;;
87
+ /var/log/kolla/redis/* )
88
+ continue
89
+ ;;
90
+ /var/log/kolla/skyline/skyline.log)
91
+ continue
92
+ ;;
93
+ * )
94
+ sudo grep -q " following tail of $file " /var/log/kolla/fluentd/fluentd.log || echo " no match for $file " && code=1
95
+ ;;
96
+ esac
97
+ done
98
+ return $code
99
+ }
100
+
32
101
function check_docker_log_file_for_sigkill {
33
102
sudo journalctl --no-pager -u ${CONTAINER_ENGINE} .service | grep " signal 9"
34
103
}
@@ -82,26 +151,35 @@ for level in CRITICAL ERROR WARNING; do
82
151
fi
83
152
done
84
153
85
- # check fluentd errors (we consider them critical)
86
- fluentd_log_file=/var/log/kolla/fluentd/fluentd.log
87
- fluentd_error_summary_file=/tmp/logs/kolla/fluentd-error.log
88
- if check_fluentd_log_file_for_level $fluentd_log_file error > /dev/null; then
89
- any_critical=1
90
- echo " (critical) Found some error log messages in fluentd logs. Matches in $fluentd_error_summary_file "
91
- check_fluentd_log_file_for_level $fluentd_log_file error > $fluentd_error_summary_file
92
- echo >> $fluentd_error_summary_file
93
- fi
154
+ if [ -d /var/log/kolla ]; then
155
+ # check fluentd errors (we consider them critical)
156
+ fluentd_log_file=/var/log/kolla/fluentd/fluentd.log
157
+ fluentd_error_summary_file=/tmp/logs/kolla/fluentd-error.log
158
+ if check_fluentd_log_file_for_level $fluentd_log_file error > /dev/null; then
159
+ any_critical=1
160
+ echo " (critical) Found some error log messages in fluentd logs. Matches in $fluentd_error_summary_file "
161
+ check_fluentd_log_file_for_level $fluentd_log_file error > $fluentd_error_summary_file
162
+ echo >> $fluentd_error_summary_file
163
+ fi
164
+
165
+ for string in " ${fluentchecks[@]} " ; do
166
+ fluentd_file=/tmp/logs/kolla/fluentd-errors.log
167
+ if check_fluentd_log_file_for_content $fluentd_log_file " $string " > /dev/null; then
168
+ any_critical=1
169
+ echo " (critical) Found some error log messages in fluentd logs. Matches in $fluentd_file "
170
+ echo " Check: $string " >> $fluentd_file
171
+ check_fluentd_log_file_for_content $fluentd_log_file " $string " >> $fluentd_file
172
+ echo >> $fluentd_file
173
+ fi
174
+ done
94
175
95
- for string in " ${fluentchecks[@]} " ; do
96
- fluentd_file=/tmp/logs/kolla/fluentd-errors.log
97
- if check_fluentd_log_file_for_content $fluentd_log_file " $string " > /dev/null; then
176
+ if check_fluentd_missing_logs > /dev/null; then
98
177
any_critical=1
99
- echo " (critical) Found some error log messages in fluentd logs. Matches in $fluentd_file "
100
- echo " Check: $string " >> $fluentd_file
101
- check_fluentd_log_file_for_content $fluentd_log_file " $string " >> $fluentd_file
102
- echo >> $fluentd_file
178
+ echo " (critical) Found some missing log files in fluentd logs. Matches in $fluentd_error_summary_file "
179
+ check_fluentd_missing_logs >> $fluentd_error_summary_file
180
+ echo >> $fluentd_error_summary_file
103
181
fi
104
- done
182
+ fi
105
183
106
184
if check_docker_log_file_for_sigkill > /dev/null; then
107
185
any_critical=1
0 commit comments