PiHole Log Rollover?

Is there a way to limit the size of the logs and make the logs rollover. Some system log have a limited size and when they fill they begin replacing the oldest entries. Since my pihole is on a pi0 I have to pihole -f daily or pihole locks up. In this way stats and such might not be wiped out and the system would keep running.

The logs consume space on the SD card, and not memory. It sounds as if your SD card is small? I run several Pi Zeros with no problems, but they have 32 GB cards with plenty of free space.

There are two places where Pi-hole stores query information.

(1) The dnsmasq logs in /var/log. These are rotated nightly, the most recent two days are uncompressed and the previous 4 days are compressed. These are typically quite small. Example below from a Pi serving 24 clients with about 20K queries per day - a few MB each at most.

ls -lha /var/log/pihole.log*

-rw-r--r-- 1 pihole pihole 3.3M Sep 23 15:59 /var/log/pihole.log
-rw-r--r-- 1 pihole pihole 5.5M Sep 23 00:00 /var/log/pihole.log.1
-rw-r--r-- 1 pihole pihole 517K Sep 22 00:00 /var/log/pihole.log.2.gz
-rw-r--r-- 1 pihole pihole 341K Sep 21 00:00 /var/log/pihole.log.3.gz
-rw-r--r-- 1 pihole pihole 336K Sep 20 00:00 /var/log/pihole.log.4.gz
-rw-r--r-- 1 pihole pihole 271K Sep 19 00:00 /var/log/pihole.log.5.gz

(2) Long term query data is stored in the long term database at /etc/pihole/pihole-FTL.db. This database grows until it reaches the limit of number of days it is set to record data (the default is 365, but this is user configurable all the way down to 0). For the same Pi with a duration set to 180 days, this database is quite a bit larger than the daily logs:

ls -lha /etc/pihole/pihole-FTL.db
-rw-r--r-- 1 pihole pihole 265M Sep 23 16:00 /etc/pihole/pihole-FTL.db

The size of these files depends primarily on the client activity on your network. The more queries, the bigger the files.

https://docs.pi-hole.net/ftldns/configfile/

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.