Skip analyze_pihole_log if query logging has been disabled

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König 2021-06-03 13:15:44 +02:00
parent df3c46349a
commit f2cba6cad1

View file

@ -1326,6 +1326,12 @@ analyze_pihole_log() {
local pihole_log_tail=()
local pihole_log_permissions
local logging_enabled=$(grep -c "^log-queries" /etc/dnsmasq.d/01-pihole.conf)
if [[ "${logging_enabled}" == "0" ]]; then
# No "log-queries" lines are found.
# Commented out lines (such as "#log-queries") are ignored
log_write "${INFO} Query logging is disabled"
else
# Put the current Internal Field Separator into another variable so it can be restored later
OLD_IFS="$IFS"
# Get the lines that are in the file(s) and store them in an array for parsing later
@ -1342,6 +1348,7 @@ analyze_pihole_log() {
log_write ""
# Set the IFS back to what it was
IFS="$OLD_IFS"
fi
}
tricorder_use_nc_or_curl() {