Make location of pihole log files configurable


In /etc/dnsmasq.d/01-pihole.conf, there is an entry log-facility=/var/log/pihole.log, so apparently, this would make the log file location configurable.
Pihole-FTL has no configuration option to make it’s logfile configurable, so it’s always /var/log/pihole-FTL.log


  • make the location of /var/log/pihole-FTL.log configurable in /etc/pihole/pihole-FTL.conf
  • modify /etc/init.d/pihole-FTL to make use of the configurable options for both pihole.log and pihole-FTL.log. This file contains hard coded locations for both the log files (touch, chown, chmod).

Apparently, somebody started the work to move the logfiles to a separate folder, but never finished it (mkdir -p /var/log/pihole, chown pihole:pihole /var/log/pihole)


Well … this is already possible using the option LOGFILE=... but is somehow missing in the docs. I will add it there, thanks for pointing this out.

Having configurable paths in the service file (plus additional locations all over the place I assume) will blow up the code significantly. My suggestion was always to create a symlink from the hard-coded location to anywhere you want the files to end up.

1 Like

Thank you for your quick reply.

Would you please explain how to do that (NOT enough Linux knowledge)…

The goal, despite the massive negative comments, is to save the SD card (a bit more), ref this topic.


Sure, see here:


If I understand this correctly, I could make use of the already created folder /var/log/pihole/, created by /etc/init.d/pihole-FTL, but never used,
mount that folder as TMPFS and have the the logs written to the TMPFS (which I will of course loose, if the pi is rebooted. Correct?

Thanks for your time and effort.


Yes. You can also just disable the logs if you don’t need them. You will still have all your data in the database.


Your guide works like a charm, as usual.
Here is the script I used to make the logs move to TMPFS:


# pihole logs
# reference
# add /var/www/html/slate7/pages/text to /etc/fstab
mkdir -p /var/log/pihole
sudo sed -i '$ a tmpfs /var/log/pihole tmpfs nodev,nosuid,gid=pihole,uid=pihole,mode=0755,size=16M 0 0' /etc/fstab
sudo mount /var/log/pihole

sudo service pihole-FTL stop
sudo cp /var/log/pihole.log /var/log/pihole
sudo rm /var/log/pihole.log
sudo cp /var/log/pihole-FTL.log /var/log/pihole
sudo rm /var/log/pihole-FTL.log
sudo ln -s /var/log/pihole/pihole.log /var/log/pihole.log
sudo ln -s /var/log/pihole/pihole-FTL.log /var/log/pihole-FTL.log
sudo service pihole-FTL start

# logrotate
mkdir -p /home/pi/custom-pihole
sudo cp /etc/pihole/logrotate /home/pi/custom-pihole
sudo sed -i 's#/var/log#/var/log/pihole#g' $file

# cron
echo "0 0 * * * root /usr/sbin/logrotate --force /home/pi/custom-pihole/logrotate" | sudo tee /etc/cron.d/custom-pihole
echo "@reboot root /usr/sbin/logrotate /home/pi/custom-pihole/logrotate" | sudo tee -a /etc/cron.d/custom-pihole

I used /home/pi/custom-pihole as the destination for the new logrotate to avoid conflicts with pihole -up and pihole -r

Thanks again for your time and effort.

Saving your SD card (a bit) parts 1..3