-
Notifications
You must be signed in to change notification settings - Fork 1
Log rotate configuration
Space is at a premium on the Jetson TX2. One way of reducing space wastage is by configuring the logrotate
package. This will limit the amount of space that log files consume on the Jetson. Often log files can grow to sizes in excess of 1GB, so this is an important configuration step.
The logrotate
package should come installed by default. To confirm its presence, run
logrotate --version
If the package is not installed, it can be installed with the following command:
sudo apt install logrotate
Man page for Ubuntu 18.04 logrotate
can be found here: https://manpages.ubuntu.com/manpages/bionic/man8/logrotate.8.html
To configure log behaviour open logrotate.conf
sudo nano logrotate.conf
You should make the following adjustments
-
Set logrotate to run daily. Replace
weekly
withdaily
-
Uncomment the line
#compress
to enable log compression with gzip -
Add
maxsize 100M
to the bottom of the file. This will rotate logs when they reach a size >=100 MB. Note that this will trigger even if the logrotate interval has not yet occurred (ie. it will run every time the log is too large, not just daily)
Open the logrotate conf file for syslog & kern.log
sudo nano /etc/logrotate.d/rsyslog
In the /var/log/syslog
and /var/log/kern.log
blocks, add a maxsize line to limit the log sizes
/var/log/syslog
{
...
maxsize 100M
...
}
...
/var/log/kern.log
...
{
...
maxsize 100M
...
}