Question & Answer
Question
Answer
There are several ways to rotate Aspera logs in Linux:
1) You can add /var/log/aspera.log to /etc/logrotate.d/syslog
2) You can create an entry for aspera.log in /etc/logrotate.conf
3) You can create a separate config file for aspera.log in /etc/logrotate.d/
The first is the easiest: simply add /var/log/aspera.log to the entries in /etc/logrotate.d/syslog. This will rotate the logs under the same conditions as syslog (usually once a week, compressed, and saving last 10 logs):
1) /etc/logrotate.d/syslog:
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron /var/log/aspera.log {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
/bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
On some servers, there is so much traffic that the logs would need to be rotated more often than once a week. In these cases you can either add a log rotate section to /etc/logrotate.conf, or create a separate /etc/logrotate.d/aspera configuration file containing the same information. This will compress and rotate 10 logs whenever /var/log/aspera.log reaches 100MB.
2) /etc/logrotate.conf
Add configuration after:
# system-specific logs may be also be configured here.
/var/log/aspera.log {
rotate 10
size 100M
create 664 root
postrotate
/usr/bin/killall -HUP syslogd
endscript
compress
}
3) Or, create file: /etc/logrotate.d/aspera with the following content:
/var/log/aspera.log {
daily
rotate 15copytruncatepostrotatecompress
chmod 644 /var/log/aspera.log || true
endscript}
Another possible simple configuration (valid for logrotate.conf and for a file inside logrotate.d) this is the faster in terms of performances (for the copytruncate) and grants a daily rotation with compression
/var/log/aspera.log {
daily
rotate 10
copytruncate
compress
}
Was this topic helpful?
Document Information
Modified date:
24 July 2019
UID
ibm10746409