mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 06:48:07 +00:00
use directory /var/log/pihole/ for log storage
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
0decc1252b
commit
36dd533ef3
@ -37,6 +37,6 @@ interface=@INT@
|
||||
cache-size=@CACHE_SIZE@
|
||||
|
||||
log-queries
|
||||
log-facility=/var/log/pihole.log
|
||||
log-facility=/var/log/pihole/pihole.log
|
||||
|
||||
log-async
|
||||
|
@ -31,7 +31,7 @@ if [ -z "$DBFILE" ]; then
|
||||
fi
|
||||
|
||||
if [[ "$@" != *"quiet"* ]]; then
|
||||
echo -ne " ${INFO} Flushing /var/log/pihole.log ..."
|
||||
echo -ne " ${INFO} Flushing /var/log/pihole/pihole.log ..."
|
||||
fi
|
||||
if [[ "$@" == *"once"* ]]; then
|
||||
# Nightly logrotation
|
||||
@ -44,9 +44,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.log /var/log/pihole.log.1
|
||||
echo " " > /var/log/pihole.log
|
||||
chmod 644 /var/log/pihole.log
|
||||
cp -p /var/log/pihole/pihole.log /var/log/pihole/pihole.log.1
|
||||
echo " " > /var/log/pihole/pihole.log
|
||||
chmod 644 /var/log/pihole/pihole.log
|
||||
fi
|
||||
else
|
||||
# Manual flushing
|
||||
@ -56,10 +56,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.log
|
||||
if [ -f /var/log/pihole.log.1 ]; then
|
||||
echo " " > /var/log/pihole.log.1
|
||||
chmod 644 /var/log/pihole.log.1
|
||||
echo " " > /var/log/pihole/pihole.log
|
||||
if [ -f /var/log/pihole/pihole.log.1 ]; then
|
||||
echo " " > /var/log/pihole/pihole.log.1
|
||||
chmod 644 /var/log/pihole/pihole.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 +70,6 @@ else
|
||||
fi
|
||||
|
||||
if [[ "$@" != *"quiet"* ]]; then
|
||||
echo -e "${OVER} ${TICK} Flushed /var/log/pihole.log"
|
||||
echo -e "${OVER} ${TICK} Flushed /var/log/pihole/pihole.log"
|
||||
echo -e " ${TICK} Deleted ${deleted} queries from database"
|
||||
fi
|
||||
|
@ -1,4 +1,4 @@
|
||||
/var/log/pihole.log {
|
||||
/var/log/pihole/pihole.log {
|
||||
# su #
|
||||
daily
|
||||
copytruncate
|
||||
@ -9,7 +9,7 @@
|
||||
nomail
|
||||
}
|
||||
|
||||
/var/log/pihole-FTL.log {
|
||||
/var/log/pihole/pihole-FTL.log {
|
||||
# su #
|
||||
weekly
|
||||
copytruncate
|
||||
|
@ -70,13 +70,13 @@ start() {
|
||||
mkdir -pm 0755 /run/pihole
|
||||
[ ! -f "${FTL_PID_FILE}" ] && install -m 644 -o pihole -g pihole /dev/null "${FTL_PID_FILE}"
|
||||
[ ! -f "${FTL_PORT_FILE}" ] && install -m 644 -o pihole -g pihole /dev/null "${FTL_PORT_FILE}"
|
||||
[ ! -f /var/log/pihole-FTL.log ] && install -m 644 -o pihole -g pihole /dev/null /var/log/pihole-FTL.log
|
||||
[ ! -f /var/log/pihole.log ] && install -m 644 -o pihole -g pihole /dev/null /var/log/pihole.log
|
||||
[ ! -f /var/log/pihole/pihole-FTL.log ] && install -m 644 -o pihole -g pihole /dev/null /var/log/pihole/pihole-FTL.log
|
||||
[ ! -f /var/log/pihole/pihole.log ] && install -m 644 -o pihole -g pihole /dev/null /var/log/pihole/pihole.log
|
||||
[ ! -f /etc/pihole/dhcp.leases ] && install -m 644 -o pihole -g pihole /dev/null /etc/pihole/dhcp.leases
|
||||
# Ensure that permissions are set so that pihole-FTL can edit all necessary files
|
||||
chown pihole:pihole /run/pihole /etc/pihole /var/log/pihole.log /var/log/pihole.log /etc/pihole/dhcp.leases
|
||||
chown pihole:pihole /run/pihole /etc/pihole /var/log/pihole/pihole-FTL.log /var/log/pihole/pihole.log /etc/pihole/dhcp.leases
|
||||
# Ensure that permissions are set so that pihole-FTL can edit the files. We ignore errors as the file may not (yet) exist
|
||||
chmod -f 0644 /etc/pihole/macvendor.db /etc/pihole/dhcp.leases /var/log/pihole-FTL.log /var/log/pihole.log
|
||||
chmod -f 0644 /etc/pihole/macvendor.db /etc/pihole/dhcp.leases /var/log/pihole/pihole-FTL.log /var/log/pihole/pihole.log
|
||||
# Chown database files to the user FTL runs as. We ignore errors as the files may not (yet) exist
|
||||
chown -f pihole:pihole /etc/pihole/pihole-FTL.db /etc/pihole/gravity.db /etc/pihole/macvendor.db
|
||||
# Chown database file permissions so that the pihole group (web interface) can edit the file. We ignore errors as the files may not (yet) exist
|
||||
|
@ -18,7 +18,7 @@
|
||||
# early morning. Download any updates from the adlists
|
||||
# Squash output to log, then splat the log to stdout on error to allow for
|
||||
# standard crontab job error handling.
|
||||
59 1 * * 7 root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole_updateGravity.log || cat /var/log/pihole_updateGravity.log
|
||||
59 1 * * 7 root PATH="$PATH:/usr/sbin:/usr/local/bin/" pihole updateGravity >/var/log/pihole/pihole_updateGravity.log || cat /var/log/pihole/pihole_updateGravity.log
|
||||
|
||||
# Pi-hole: Flush the log daily at 00:00
|
||||
# The flush script will use logrotate if available
|
||||
|
@ -187,12 +187,12 @@ Available commands and options:
|
||||
|
||||
(Logging options):
|
||||
.br
|
||||
on Enable the Pi-hole log at /var/log/pihole.log
|
||||
on Enable the Pi-hole log at /var/log/pihole/pihole.log
|
||||
.br
|
||||
off Disable and flush the Pi-hole log at
|
||||
/var/log/pihole.log
|
||||
/var/log/pihole/pihole.log
|
||||
.br
|
||||
off noflush Disable the Pi-hole log at /var/log/pihole.log
|
||||
off noflush Disable the Pi-hole log at /var/log/pihole/pihole.log
|
||||
.br
|
||||
|
||||
\fB-up, updatePihole\fR [--check-only]
|
||||
|
8
pihole
8
pihole
@ -254,9 +254,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.log
|
||||
off Disable and flush the Pi-hole log at /var/log/pihole.log
|
||||
off noflush Disable the Pi-hole log at /var/log/pihole.log"
|
||||
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"
|
||||
exit 0
|
||||
elif [[ "${1}" == "off" ]]; then
|
||||
# Disable logging
|
||||
@ -382,7 +382,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.log | grep --line-buffered "${1}" | sed -E \
|
||||
tail -f /var/log/pihole/pihole.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}," \
|
||||
|
Loading…
Reference in New Issue
Block a user