How To Implement Log Rotation for PDS
- Product: All products using PDS
- Relevant for Installation Type: Dedicated-Direct, Direct, Local
Description
On busy servers, PDS log files can grow to large sizes, making them very hard to navigate and eating up free space. One solution for this is to rotate the logs so that they are replaced periodically (usually, hourly or daily).
Resolution
As the product user (primo, aleph, etc.) type the following:
pdsroot
Edit the file pdslogrotate.conf (which you may need to create), and paste the following lines into it:
# Logrotate file for pds_log <Log directory>/pds_server.log { missingok compress notifempty rotate 20 size 100M }
where <Log directory is the PDS log location, which can be retrieved by typing (as the product user):
echo $LOGDIR
After making the changes to the pdslogrotatre.conf file, add the following to crontab using crontab -e (edit it to your preference to run hourly or daily):
12 * * * * /usr/sbin/logrotate -s /tmp/statefile <PDS root directory>/logrotate.conf > /dev/null 2>&1
Where <PDS root directory> is the pds directory you get to when typing pdsroot (you can get that using the pwd command).
- Article last edited: 21-June-2017