@@ -55,12 +55,14 @@ start() {
5555 fix_capabilities
5656 sh /opt/pihole/pihole-FTL-prestart.sh
5757
58- # Get the FTL log file path from the config
58+ # Get the FTL and web server log file path from the config
5959 FTLlogFile=$( getFTLConfigValue files.log.ftl)
60+ WEBlogFile=$( getFTLConfigValue files.log.webserver)
6061
61- # Get the EOF position of the FTL log file so that we can tail from there later.
62- local startFrom
63- startFrom=$( stat -c%s " ${FTLlogFile} " )
62+ # Get the EOF position of the FTL and web server log file so that we can tail from there later.
63+ local FTLstartFrom WEBstartFrom
64+ FTLstartFrom=$( stat -c%s " ${FTLlogFile} " )
65+ WEBstartFrom=$( stat -c%s " ${WEBlogFile} " )
6466
6567 echo " [i] Starting pihole-FTL ($FTL_CMD ) as ${DNSMASQ_USER} "
6668 echo " "
@@ -75,7 +77,7 @@ start() {
7577 CAPSH_PID=$!
7678
7779 # Wait for FTL to start by monitoring the FTL log file for the "FTL started" line
78- if ! timeout 30 tail -F -c +$(( startFrom + 1 )) -- " ${FTLlogFile} " | grep -q ' ########## FTL started' ; then
80+ if ! timeout 30 tail -F -c +$(( FTLstartFrom + 1 )) -- " ${FTLlogFile} " | grep -q ' ########## FTL started' ; then
7981 echo " [!] ERROR: Did not find 'FTL started' message in ${FTLlogFile} in 30 seconds, stopping container"
8082 exit 1
8183 fi
@@ -89,10 +91,19 @@ start() {
8991
9092 if [ " ${TAIL_FTL_LOG:- 1} " -eq 1 ]; then
9193 # Start tailing the FTL log file from the EOF position we recorded on container start
92- tail -F -c +$(( startFrom + 1 )) -- " ${FTLlogFile} " &
94+ tail -F -c +$(( FTLstartFrom + 1 )) -- " ${FTLlogFile} " &
9395 else
9496 echo " [i] FTL log output is disabled. Remove the Environment variable TAIL_FTL_LOG, or set it to 1 to enable FTL log output."
9597 fi
98+ if [ " ${TAIL_WEB_LOG:- 1} " -eq 1 ]; then
99+ # Start tailing the web server log file from the EOF position we recorded on container start
100+ tail -F -c +$(( WEBstartFrom + 1 )) -- " ${WEBlogFile} " &
101+ else
102+ echo " [i] Web server log output is disabled. Remove the Environment variable TAIL_WEB_LOG, or set it to 1 to enable web server log output."
103+ fi
104+
105+
106+
96107
97108 # Wait for the capsh process (which spawned FTL) to finish
98109 wait $CAPSH_PID
0 commit comments