Sign Up
Log In
Sign Up
Username:
*
Email:
*
Password:
*
Password confirmation:
*
or
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Web
pi-hole
configurable-log-paths.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File configurable-log-paths.patch of Package pi-hole
Index: pi-hole-5.17/pihole =================================================================== --- pi-hole-5.17.orig/pihole +++ pi-hole-5.17/pihole @@ -31,6 +31,18 @@ if [ -f "${versionsfile}" ]; then source "${versionsfile}" fi +# Find out config paths. +pihole_FTL="etc/pihole/pihole-FTL.conf" +if [[ -f "${pihole_FTL}" ]]; then + source "${pihole_FTL}" +fi + +dnsmasq_log=$(awk 'match($0, /log-facility=(.*)/, a) {print a[1]}' /etc/dnsmasq.d/01-pihole.conf) +if [ -z "$dnsmasq_log" ]; then + # If no config set, use default log location. + dnsmasq_log=/var/log/pihole.log +fi + webpageFunc() { source "${PI_HOLE_SCRIPT_DIR}/webpage.sh" main "$@" @@ -261,9 +273,9 @@ Example: 'pihole logging on' Specify whether the Pi-hole log should be used Options: - on Enable the Pi-hole log at /var/log/pihole/pihole.log - off Disable and flush the Pi-hole log at /var/log/pihole/pihole.log - off noflush Disable the Pi-hole log at /var/log/pihole/pihole.log" + on Enable the Pi-hole log at ${dnsmasq_log} + off Disable and flush the Pi-hole log at ${dnsmasq_log} + off noflush Disable the Pi-hole log at ${dnsmasq_log}" exit 0 elif [[ "${1}" == "off" ]]; then # Disable logging @@ -396,7 +408,7 @@ tailFunc() { # Color blocklist/blacklist/wildcard entries as red # Color A/AAAA/DHCP strings as white # Color everything else as gray - tail -f /var/log/pihole/pihole.log | grep --line-buffered "${1}" | sed -E \ + tail -f ${dnsmasq_log} | grep --line-buffered "${1}" | sed -E \ -e "s,($(date +'%b %d ')| dnsmasq\[[0-9]*\]),,g" \ -e "s,(.*(blacklisted |gravity blocked ).*),${COL_RED}&${COL_NC}," \ -e "s,.*(query\\[A|DHCP).*,${COL_NC}&${COL_NC}," \ Index: pi-hole-5.17/advanced/Scripts/piholeLogFlush.sh =================================================================== --- pi-hole-5.17.orig/advanced/Scripts/piholeLogFlush.sh +++ pi-hole-5.17/advanced/Scripts/piholeLogFlush.sh @@ -30,8 +30,15 @@ if [ -z "$DBFILE" ]; then DBFILE="/etc/pihole/pihole-FTL.db" fi +# Find out dnsmasq log file. +dnsmasq_log=$(awk 'match($0, /log-facility=(.*)/, a) {print a[1]}' /etc/dnsmasq.d/01-pihole.conf) +if [ -z "$var" ]; then + # If no config set, use default log location. + dnsmasq_log=/var/log/pihole.log +fi + if [[ "$@" != *"quiet"* ]]; then - echo -ne " ${INFO} Flushing /var/log/pihole/pihole.log ..." + echo -ne " ${INFO} Flushing ${dnsmasq_log} ..." fi if [[ "$@" == *"once"* ]]; then # Nightly logrotation @@ -44,9 +51,9 @@ if [[ "$@" == *"once"* ]]; then # Note that moving the file is not an option, as # dnsmasq would happily continue writing into the # moved file (it will have the same file handler) - cp -p /var/log/pihole/pihole.log /var/log/pihole/pihole.log.1 - echo " " > /var/log/pihole/pihole.log - chmod 640 /var/log/pihole/pihole.log + cp -p ${dnsmasq_log} ${dnsmasq_log}.1 + echo " " > ${dnsmasq_log} + chmod 640 ${dnsmasq_log} fi else # Manual flushing @@ -56,10 +63,10 @@ else /usr/sbin/logrotate --force --state "${STATEFILE}" /etc/pihole/logrotate else # Flush both pihole.log and pihole.log.1 (if existing) - echo " " > /var/log/pihole/pihole.log - if [ -f /var/log/pihole/pihole.log.1 ]; then - echo " " > /var/log/pihole/pihole.log.1 - chmod 640 /var/log/pihole/pihole.log.1 + echo " " > ${dnsmasq_log} + if [ -f ${dnsmasq_log}.1 ]; then + echo " " > ${dnsmasq_log}.1 + chmod 640 ${dnsmasq_log}.1 fi fi # Delete most recent 24 hours from FTL's database, leave even older data intact (don't wipe out all history) @@ -70,6 +77,6 @@ else fi if [[ "$@" != *"quiet"* ]]; then - echo -e "${OVER} ${TICK} Flushed /var/log/pihole/pihole.log" + echo -e "${OVER} ${TICK} Flushed ${dnsmasq_log}" echo -e " ${TICK} Deleted ${deleted} queries from database" fi
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Contact
Support
@OBShq
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor