-
Notifications
You must be signed in to change notification settings - Fork 64
Configure logrotate
Enrique Barra Arias edited this page Aug 23, 2017
·
2 revisions
To rotate the log files (production and search logs) and avoid them becoming really huge we recommend using logrotate. To configure it you have to do the following commands:
cp /u/apps/vish/current/lib/scripts/restart_sphinx.sh /u/apps/vish/shared/scripts/.
chmod +x /u/apps/vish/shared/scripts/restart_sphinx.sh
Now edit a file called /etc/logrotate.d/vish with the content of the file located in your vish installation at the path /extras/logrotate.conf changing the word username for your real Ubuntu username.
The content of the /extras/logrotate.conf file is:
/u/apps/vish/shared/log/production.log {
weekly
missingok
rotate 12
maxage 84
notifempty
create 0660 username www-data
sharedscripts
compress
delaycompress
su username www-data
postrotate
touch /u/apps/vish/current/tmp/restart.txt
endscript
}
/u/apps/vish/shared/log/search*.log {
weekly
missingok
rotate 12
maxage 84
notifempty
create 0777 username www-data
sharedscripts
compress
delaycompress
su username www-data
postrotate
bash -c "export CAP_USER=username && /u/apps/vish/shared/scripts/restart_sphinx.sh"
endscript
}