OK, I think I understand your question now. Logrotate does not control where applications write their logs. It only rotates files that already exist. So if you have a logrotate configuration that refers to an empty directory, that directory will stay empty.
The Apache config you posted will log activity to /srv/www/example.com/logs/access.log and errors to /srv/www/example.com/logs/error.log. These should be rotated by the apache2 logrotate configuration you posted (although you should make sure there's a space between "/srv/www/*/logs/*.log" and the opening brace). The
weekly option means that these logs will be rotated at the beginning of each week. The
compress option will compress rotated logs, but
delaycompress means that the first rotated log will not be compressed. So after a few weeks, your directory should have files like this:
Code:
access.log
access.log.1
access.log.2.gz
access.log.3.gz
error.log
error.log.1
error.log.2.gz
error.log.3.gz
The
rotate 52 option will keep 52 old log files around. You can change this by reducing the number or by adding a
maxage option as discussed before.
The locations where logs are written is controlled by your Apache configuration. You should look at the main configuration file and all the virtual host configuration files in /etc/apache2/sites-enabled/ to see where they are logging. This command should show you:
Code:
grep -RE 'CustomLog|ErrorLog|RewriteLog' /etc/apache2/apache2.conf /etc/apache2/sites-enabled/
Edit: If I need to run several commands as root, I usually do
sudo su - to get a root shell. You need to be careful while doing this, and very aware of what you're doing while root. Type
exit as soon as you are finished the task and you will revert to a normal user.