Logrotate /etc/logrotate.d

Hi!

Having problem on one of my boxes with logrotate. Here's the scenario:

1) The box hosts multiple websites, all in /var/www and the structure is the same on all sites:````
/var/www/domain/public_html
/var/www/domain/logs

access.log and error.log is site specific and saved in each logs-directory. Now I'm also having a folder for each site:````
/var/www/domain/public_html/admin/logs

In the latter I keep log files for outgoing emails from each site, as well as logs from the payment providers etc. Here's the problem, my logrotation script:````
/var/www//logs/.log {
weekly
missingok
rotate 7
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
}

/var/www//publichtml/admin/logs/.log {
weekly
missingok
rotate 7
compress
delaycompress
notifempty
create 775 kansliet
master www-data
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
}

````

The thing is that on one of the servers (there are two in the environment with the same configuration hosting different sites) everything is working okay. But on the other one, on some sites, the log files in /var/www//publichtml/admin/logs/* are rotated by the snippet for /var/www//logs/.log and my guess is the * in the paths, which will match both directories. As you see the only difference is the owner of the files rotated and right now the files in /var/www/domain/publichtml/admin/logs is getting root adm as owner group and the web server cannot write to these files anymore, which made that alla log files are empty and the site is throwing a permissios error.

How to I change the upper most snippet only to match access.log and error.log in each /var/www/domain/logs folder?

Thanks!

1 Reply

````
/var/www//logs/access.log /var/www//logs/error.log
{
weekly
[…]
}

````

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct