mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-25 14:20:18 +00:00
Skip analyze_pihole_log if query logging has been disabled
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
df3c46349a
commit
f2cba6cad1
1 changed files with 27 additions and 20 deletions
|
@ -1321,27 +1321,34 @@ obfuscated_pihole_log() {
|
||||||
}
|
}
|
||||||
|
|
||||||
analyze_pihole_log() {
|
analyze_pihole_log() {
|
||||||
echo_current_diagnostic "Pi-hole log"
|
echo_current_diagnostic "Pi-hole log"
|
||||||
local pihole_log_head=()
|
local pihole_log_head=()
|
||||||
local pihole_log_tail=()
|
local pihole_log_tail=()
|
||||||
local pihole_log_permissions
|
local pihole_log_permissions
|
||||||
|
|
||||||
# Put the current Internal Field Separator into another variable so it can be restored later
|
local logging_enabled=$(grep -c "^log-queries" /etc/dnsmasq.d/01-pihole.conf)
|
||||||
OLD_IFS="$IFS"
|
if [[ "${logging_enabled}" == "0" ]]; then
|
||||||
# Get the lines that are in the file(s) and store them in an array for parsing later
|
# No "log-queries" lines are found.
|
||||||
IFS=$'\r\n'
|
# Commented out lines (such as "#log-queries") are ignored
|
||||||
pihole_log_permissions=$(ls -ld "${PIHOLE_LOG}")
|
log_write "${INFO} Query logging is disabled"
|
||||||
log_write "${COL_GREEN}${pihole_log_permissions}${COL_NC}"
|
else
|
||||||
mapfile -t pihole_log_head < <(head -n 20 ${PIHOLE_LOG})
|
# Put the current Internal Field Separator into another variable so it can be restored later
|
||||||
log_write " ${COL_CYAN}-----head of $(basename ${PIHOLE_LOG})------${COL_NC}"
|
OLD_IFS="$IFS"
|
||||||
obfuscated_pihole_log "${pihole_log_head[@]}"
|
# Get the lines that are in the file(s) and store them in an array for parsing later
|
||||||
log_write ""
|
IFS=$'\r\n'
|
||||||
mapfile -t pihole_log_tail < <(tail -n 20 ${PIHOLE_LOG})
|
pihole_log_permissions=$(ls -ld "${PIHOLE_LOG}")
|
||||||
log_write " ${COL_CYAN}-----tail of $(basename ${PIHOLE_LOG})------${COL_NC}"
|
log_write "${COL_GREEN}${pihole_log_permissions}${COL_NC}"
|
||||||
obfuscated_pihole_log "${pihole_log_tail[@]}"
|
mapfile -t pihole_log_head < <(head -n 20 ${PIHOLE_LOG})
|
||||||
log_write ""
|
log_write " ${COL_CYAN}-----head of $(basename ${PIHOLE_LOG})------${COL_NC}"
|
||||||
# Set the IFS back to what it was
|
obfuscated_pihole_log "${pihole_log_head[@]}"
|
||||||
IFS="$OLD_IFS"
|
log_write ""
|
||||||
|
mapfile -t pihole_log_tail < <(tail -n 20 ${PIHOLE_LOG})
|
||||||
|
log_write " ${COL_CYAN}-----tail of $(basename ${PIHOLE_LOG})------${COL_NC}"
|
||||||
|
obfuscated_pihole_log "${pihole_log_tail[@]}"
|
||||||
|
log_write ""
|
||||||
|
# Set the IFS back to what it was
|
||||||
|
IFS="$OLD_IFS"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
tricorder_use_nc_or_curl() {
|
tricorder_use_nc_or_curl() {
|
||||||
|
|
Loading…
Reference in a new issue