Tatsh / tatsh-overlay

Personal Gentoo Portage overlay.
https://tatsh.github.io/tatsh-overlay/
GNU General Public License v2.0
35 stars 12 forks source link

net-dns/pihole: No file or directory for /etc/pihole/logrotate and /var/log/pihole.log #118

Closed Bogdan107 closed 2 years ago

Bogdan107 commented 2 years ago

I have some errors by cron: 1) error: cannot stat /etc/pihole/logrotate: No such file or directory Command: /usr/bin/logrotate /etc/pihole/logrotate. Command called from /etc/cron.d/pihole. 2) error: stat of /var/log/pihole.log failed: No such file or directory Command: PATH="$PATH:/usr/sbin" /usr/bin/pihole flush once quiet. Command called from /etc/cron.d/pihole.

Problem is that neither /etc/pihole/logrotate no /var/log/pihole.log file does not exists. But /etc/logrotate.d/pihole and /var/log/pihole-FTL.log file exists.

Please, make modifications:

Bogdan107 commented 2 years ago

Also, I have conflict with logrotate system service and logrotate pihole script.

My logrotate system service started daily from /etc/cron.daily/logrotate script (at any time). Pihole logrotate script started daily at 00:00 from /etc/cron.d/pihole script. So in that configuration /var/log/pihole.log file will be logrotated twice per day, but must be logrotated once per day.

Please, resolve this conflict. I know about two variants: 1) comment/remove Flush the log daily at 00:00 task in /etc/cron.d/pihole; 2) remove pihole script from system logrotate service (by moving /etc/logrotate/pihole to /etc/pihole/logrotate).

I think, that pihole logrotate task in /etc/cron.d/pihole is more preferenceble, as logfiles will be stronger in timestamps. I like this variant. But I use pihole in my laptop, which I start and stop at any time. And most of peoples laptop's are swithed off at 00:00 time. So, I think that pihole's logs must be logrotated by system logrotate service, not exactly at 00:00 by pihole cron file. So, variant 2 is more preferrable for personal computers (laptops).

Please, update ebuild.

Tatsh commented 2 years ago

I think it would be better to just have logrotate and no flushing in the crontab file. I did not realise exactly what the crontab file had in it as I do not use it. It is redundant to have both.

The logrotate config needs to have missingok in both sections.

Tatsh commented 2 years ago

I just realised, Pi-hole needs an update and I didn't catch this due to a regex issue. I am going to get that with this issue fixed.

Bogdan107 commented 2 years ago

May be improve logrotate use flag for controlling logrotate config at /etc/logrotate/pihole path?

Something like this:

Tatsh commented 2 years ago

If you want to change /etc stuff that is okay and Portage will not change those files without giving confirmation (you need to use dispatch-conf, etc). You can even mask a file away if you don't want it in make.conf.

Therefore, to use your preferred config I suggest masking away the files and putting your own versions in place.

Tatsh commented 2 years ago

For the ticket title, this is resolved with: https://github.com/Tatsh/tatsh-overlay/commit/48377046dce0a19c20127d411f0a94ce17617618