Awstats & logrotate

Hi happy hestia users!

I have an issue with awstats & logrotate and I am wondering if this issue is on all hestia installations or not.

Awstats updates every day @ 3:30 am, and that runs without any errors.
Awstats also updates when logrotate rotates the apache2 logs. In /etc/logrotate.d/apache2 there is a prerotate command that runs /etc/logrotate.d/httpd-prerotate/awstats which runs /usr/share/awstats/tools/

Now, my problem is that only when awstats is being called by logrotate, it does not update the stats, but gives an error in syslog:

logrotate[490943]: Error while processing /etc/awstats/awstats.{domain}.conf
logrotate[491025]: Error: Failed to open directory /home/{user}/web/{domain}/stats : Permission denied

And it gives this error for all domains on the server that have awstats enabled. But, once again, only when it is being triggered by logrotate. This results in a gap in the stats produced by awstats.

Let’s have a look at the permissions on that stats directory:

stat /home/{user}/web/{domain}/stats/

File: /home/{user}/web/{domain}/stats/
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 801h/2049d Inode: 1297087 Links: 7
Access: (0551/dr-xr-x–x) Uid: ( {userid}/{user}) Gid: ( {groupid}/{user})
Access: 2023-02-05 05:10:02.219481441 +0100
Modify: 2023-02-05 03:30:20.667990048 +0100
Change: 2023-02-05 03:30:20.715990332 +0100
Birth: 2022-11-01 15:39:10.499380407 +0100

If you are not having this issue, what are the permissions on your stats directory?
Kind regards.

It’s a bug. Bugreport and solution @ github: [Bug] awstats not updated by logrotate · Issue #3289 · hestiacp/hestiacp · GitHub

1 Like

Thanks it looks like we need to create a custom log rotate function for it then

1 Like

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