General logging of the system

Transporting from GitHub:

Right now the system logs a few things. After an installation there is an installation log, and during the day all activity from dnsmasq is logged. In the default installation that logfile is purged, therefor the admin interface will only show ‘todays’ activity.

Would it be helpfull if there is a general logfile that is not overwritten and saves a few things? Think things like the weekly update of the adlists, the automatic update of the system, maybe even the daily statistics before the normal pihole log is flushed at the end of the day

(logfile flushed, results for 2016-02-16: xx queries, xx.xxx dns queries, xx % ads, on this day xx.xxx domains are blocked by pi-hole).

That way you can look back and see if things have indeed taken place. It would also allow for things like

pi-hole system upgraded from 2.5.2 to 2.5.3 on 2016-12-18 23:55 hrs.

Write the logging of ‘pihole -g’ and the scheduled ‘pihole updateGravity’ in a logfile. With a long blocklist (> 0,5 mil.) it takes a long period reading/checking the blocklist at the end of the updateGravity process. In the meantime Cron tried to connect the SMTP server for sending the mail. After the reading of the blocklist is completed you see in pihole -t log a lot of tries to get connected. In mailerr.log a connect problem is written. I think that the answer of the mailserver is missed by the Pi because the high CPU load. I have tried this with a local SMTP server and with Gmail SMTP. So, I didn’t receive a mail for the Gravity action.

I have solved this by changing /etc/crond.d/pihole
59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity >/var/log/updateGravity.log

I haven’t changed pihole.sh but this can be done in the same method for pihole -g process
Bij using a > the updateGravity.log is overwritten each time, so only the latest is shown in /var/log/.

I also have scheduled a task for mailing the info in this file.

I use a PI3, a high speed 32 GB SD card and the ssmtp, mailutils and mpack packages for mail.

This feature request is related, but a larger scope than what you are asking. If you’re ok with it, I’ll merge your comment into that feature request, which has more votes than this one.

Hi Jacob

for me it is no problem merging it with the other topic.

Done. Thank you very much.

Write the logging of ‘pihole -g’ and the scheduled ‘pihole updateGravity’ in a logfile. With a long blocklist (> 0,5 mil.) it takes a long period reading/checking the blocklist at the end of the updateGravity process. In the meantime Cron tried to connect the SMTP server for sending the mail. After the reading of the blocklist is completed you see in pihole -t log a lot of tries to get connected. In mailerr.log a connect problem is written. I think that the answer of the mailserver is missed by the Pi because the high CPU load. I have tried this with a local SMTP server and with Gmail SMTP. So, I didn’t receive a mail for the Gravity action.

I have solved this by changing /etc/crond.d/pihole
59 1 * * 7 root PATH="$PATH:/usr/local/bin/" pihole updateGravity >/var/log/updateGravity.log

I haven’t changed pihole.sh but this can be done in the same method for pihole -g process
Bij using a > the updateGravity.log is overwritten each time, so only the latest is shown in /var/log/.

I also have scheduled a task for mailing the info in this file.

I use a PI3, a high speed 32 GB SD card and the ssmtp, mailutils and mpack packages for mail.