On my server Ubuntu 10.04 with ispconfig 3.x, the rotation log file didn't work. Search, search, search on internet but nothing helped me.
After investigating I found the solution, so let me share it with the internet community.
ISP Config 3 has a cron daily job active for that.
crontab -l
* * * * * /usr/local/ispconfig/server/server.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
30 00 * * * /usr/local/ispconfig/server/cron_daily.sh 2>&1 > /dev/null | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done
Cron_daily.sh run a the php cron_daily.php.
The script search the log file in the client web folder, for ie example /var/www/clients/client1/web1/log/error.log. This folder is empty!
Logs are stored in /var/log/ispconfig/httpd/mydomain.com for example /var/log/ispconfig/httpd/byman.it
So to fix the problem I deleted the client log folder and created a symbolic link. Of course you need a root access.
#permission 2022-08-23 I got the same issue of log rotation and I got trouble to remove log folder: Operation not permitted. I find the solution on How To Force Forum, thx to Till
The web directories are protected!
- CHECK
lsattr /var/www/clients/client1/
- CHANGE : remove protection attribute
chattr -i /var/www/clients/client1/web1
- REMOVE FOLDER
rm /var/www/clients/client1/web1/log -r
- CREATE LINK
ln /var/log/ispconfig/httpd/byman.it/ /var/www/byman.it/log -s
- CHANGE: add protection attribute
chattr +i /var/www/clients/client1/web1
byman.it -> /var/www/clients/client1/web1 is a symbolic file. I used it that because it's easier remeber the domain instead of the clientx webxx.
You fixed 2 problem:
- Log File Rotation and Compressing
- Log accessible from Client FTP. Your clients can open the log file under /web/logs folder.
I hope this fix will help someone to save time.
- have fun -