mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-01-11 22:44:44 +00:00
Merge pull request #460 from pi-hole/LighttpdDebugLogging
Added lighttpd error.log to debug output
This commit is contained in:
commit
2d03616c10
1 changed files with 53 additions and 24 deletions
|
@ -19,6 +19,7 @@ DEBUG_LOG="/var/log/pihole_debug.log"
|
||||||
DNSMASQFILE="/etc/dnsmasq.conf"
|
DNSMASQFILE="/etc/dnsmasq.conf"
|
||||||
PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf"
|
PIHOLECONFFILE="/etc/dnsmasq.d/01-pihole.conf"
|
||||||
LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf"
|
LIGHTTPDFILE="/etc/lighttpd/lighttpd.conf"
|
||||||
|
LIGHTTPDERRFILE="/var/log/lighttpd/error.log"
|
||||||
GRAVITYFILE="/etc/pihole/gravity.list"
|
GRAVITYFILE="/etc/pihole/gravity.list"
|
||||||
HOSTSFILE="/etc/hosts"
|
HOSTSFILE="/etc/hosts"
|
||||||
WHITELISTFILE="/etc/pihole/whitelist.txt"
|
WHITELISTFILE="/etc/pihole/whitelist.txt"
|
||||||
|
@ -53,6 +54,19 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Private functions exist here ###
|
### Private functions exist here ###
|
||||||
|
function versionCheck {
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
echo "########## Versions Section ###########" >> $DEBUG_LOG
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
|
||||||
|
TMP=$(cd /etc/.pihole/ && git describe --tags --abbrev=0)
|
||||||
|
echo "Pi-hole Version: $TMP" >> $DEBUG_LOG
|
||||||
|
|
||||||
|
TMP=$(cd /var/www/html/admin && git describe --tags --abbrev=0)
|
||||||
|
echo "WebUI Version: $TMP" >> $DEBUG_LOG
|
||||||
|
echo >> $DEBUG_LOG
|
||||||
|
}
|
||||||
|
|
||||||
function compareWhitelist {
|
function compareWhitelist {
|
||||||
if [ ! -f "$WHITELISTMATCHES" ]; then
|
if [ ! -f "$WHITELISTMATCHES" ]; then
|
||||||
$SUDO touch $WHITELISTMATCHES
|
$SUDO touch $WHITELISTMATCHES
|
||||||
|
@ -126,12 +140,44 @@ function checkProcesses {
|
||||||
for i in "${PROCESSES[@]}"
|
for i in "${PROCESSES[@]}"
|
||||||
do
|
do
|
||||||
echo "" >> $DEBUG_LOG
|
echo "" >> $DEBUG_LOG
|
||||||
echo -n $i >> "$DEBUG_LOG"
|
echo -n "$i" >> "$DEBUG_LOG"
|
||||||
echo " processes status:" >> $DEBUG_LOG
|
echo " processes status:" >> $DEBUG_LOG
|
||||||
$SUDO systemctl -l status $i >> "$DEBUG_LOG"
|
$SUDO systemctl -l status "$i" >> "$DEBUG_LOG"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function debugLighttpd {
|
||||||
|
echo "::: Writing lighttpd to debug log..."
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
echo "############ lighttpd.conf ############" >> $DEBUG_LOG
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
if [ -e "$LIGHTTPDFILE" ]
|
||||||
|
then
|
||||||
|
while read -r line; do
|
||||||
|
if [ ! -z "$line" ]; then
|
||||||
|
[[ "$line" =~ ^#.*$ ]] && continue
|
||||||
|
echo "$line" >> $DEBUG_LOG
|
||||||
|
fi
|
||||||
|
done < "$LIGHTTPDFILE"
|
||||||
|
echo >> $DEBUG_LOG
|
||||||
|
else
|
||||||
|
echo "No lighttpd.conf file found!" >> $DEBUG_LOG
|
||||||
|
printf ":::\tNo lighttpd.conf file found\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "$LIGHTTPDERRFILE" ]
|
||||||
|
then
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
echo "######### lighttpd error.log ##########" >> $DEBUG_LOG
|
||||||
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
cat "$LIGHTTPDERRFILE" >> $DEBUG_LOG
|
||||||
|
else
|
||||||
|
echo "No lighttpd error.log file found!" >> $DEBUG_LOG
|
||||||
|
printf ":::\tNo lighttpd error.log file found\n"
|
||||||
|
fi
|
||||||
|
echo >> $DEBUG_LOG
|
||||||
|
}
|
||||||
|
|
||||||
### END FUNCTIONS ###
|
### END FUNCTIONS ###
|
||||||
|
|
||||||
### Check Pi internet connections ###
|
### Check Pi internet connections ###
|
||||||
|
@ -148,10 +194,12 @@ echo "Gateway check:" >> $DEBUG_LOG
|
||||||
echo "$GATEWAY_CHECK" >> $DEBUG_LOG
|
echo "$GATEWAY_CHECK" >> $DEBUG_LOG
|
||||||
echo >> $DEBUG_LOG
|
echo >> $DEBUG_LOG
|
||||||
|
|
||||||
|
versionCheck
|
||||||
compareWhitelist
|
compareWhitelist
|
||||||
compareBlacklist
|
compareBlacklist
|
||||||
testNslookup
|
testNslookup
|
||||||
checkProcesses
|
checkProcesses
|
||||||
|
debugLighttpd
|
||||||
|
|
||||||
echo "::: Writing dnsmasq.conf to debug log..."
|
echo "::: Writing dnsmasq.conf to debug log..."
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
|
@ -178,7 +226,6 @@ echo "########### 01-pihole.conf ############" >> $DEBUG_LOG
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
if [ -e "$PIHOLECONFFILE" ]
|
if [ -e "$PIHOLECONFFILE" ]
|
||||||
then
|
then
|
||||||
#cat "$PIHOLECONFFILE" >> $DEBUG_LOG
|
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [ ! -z "$line" ]; then
|
if [ ! -z "$line" ]; then
|
||||||
[[ "$line" =~ ^#.*$ ]] && continue
|
[[ "$line" =~ ^#.*$ ]] && continue
|
||||||
|
@ -191,25 +238,6 @@ else
|
||||||
printf ":::\tNo 01-pihole.conf file found\n"
|
printf ":::\tNo 01-pihole.conf file found\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "::: Writing lighttpd.conf to debug log..."
|
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
|
||||||
echo "############ lighttpd.conf ############" >> $DEBUG_LOG
|
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
|
||||||
if [ -e "$LIGHTTPDFILE" ]
|
|
||||||
then
|
|
||||||
#cat "$PIHOLECONFFILE" >> $DEBUG_LOG
|
|
||||||
while read -r line; do
|
|
||||||
if [ ! -z "$line" ]; then
|
|
||||||
[[ "$line" =~ ^#.*$ ]] && continue
|
|
||||||
echo "$line" >> $DEBUG_LOG
|
|
||||||
fi
|
|
||||||
done < "$LIGHTTPDFILE"
|
|
||||||
echo >> $DEBUG_LOG
|
|
||||||
else
|
|
||||||
echo "No lighttpd.conf file found!" >> $DEBUG_LOG
|
|
||||||
printf ":::\tNo lighttpd.conf file found\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "::: Writing size of gravity.list to debug log..."
|
echo "::: Writing size of gravity.list to debug log..."
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
echo "############ gravity.list #############" >> $DEBUG_LOG
|
echo "############ gravity.list #############" >> $DEBUG_LOG
|
||||||
|
@ -283,7 +311,7 @@ fi
|
||||||
|
|
||||||
# Continuously append the pihole.log file to the pihole_debug.log file
|
# Continuously append the pihole.log file to the pihole_debug.log file
|
||||||
function dumpPiHoleLog {
|
function dumpPiHoleLog {
|
||||||
trap '{ echo -e "\nFinishing debug write from interrupt... Quitting!" ; exit 1; }' INT
|
trap '{ echo -e "\n::: Finishing debug write from interrupt... Quitting!" ; exit 1; }' INT
|
||||||
echo -e "::: Writing current pihole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)"
|
echo -e "::: Writing current pihole traffic to debug log...\n:::\tTry loading any/all sites that you are having trouble with now... \n:::\t(Press ctrl+C to finish)"
|
||||||
echo "#######################################" >> $DEBUG_LOG
|
echo "#######################################" >> $DEBUG_LOG
|
||||||
echo "############# pihole.log ##############" >> $DEBUG_LOG
|
echo "############# pihole.log ##############" >> $DEBUG_LOG
|
||||||
|
@ -303,6 +331,7 @@ function dumpPiHoleLog {
|
||||||
# Anything to be done after capturing of pihole.log terminates
|
# Anything to be done after capturing of pihole.log terminates
|
||||||
function finalWork {
|
function finalWork {
|
||||||
echo "::: Finshed debugging!"
|
echo "::: Finshed debugging!"
|
||||||
|
echo "::: Debug log can be found at : /var/log/pihole_debug.log"
|
||||||
}
|
}
|
||||||
trap finalWork EXIT
|
trap finalWork EXIT
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue