Log rotatation in
some compressed files some files which ends with
The location of log rotation configs is in
Explanation of some parameters:
- weekly: weekly says that you want to
- rotate 4: it says that how many rotated files should be kept, here I keep 4 rotated files (one month).
- compress: well you tell me what this parameter does.
- delaycompress: some programs do not close file handlers immediately, here we tell log rotate to delay the compression.
- missingok: don't return error if the log file is missing
OK, the list goes on. Take a look at the manual yourself and see its options.
#linux #logrotate #rotate
Linux
is so handy as its name implies, it rotates log files. If you have a look at the /var/log
path you can seesome compressed files some files which ends with
.1
/var/log/my-app.log {
weekly
rotate 4
compress
delaycompress
missingok
notifempty
create 644 root root
}
The location of log rotation configs is in
/etc/logrotate.d/
. I have created a file in it with the config above.Explanation of some parameters:
- weekly: weekly says that you want to
Linux
to rotate your log files weekly, you can also set daily, monthly, yearly.- rotate 4: it says that how many rotated files should be kept, here I keep 4 rotated files (one month).
- compress: well you tell me what this parameter does.
- delaycompress: some programs do not close file handlers immediately, here we tell log rotate to delay the compression.
- missingok: don't return error if the log file is missing
OK, the list goes on. Take a look at the manual yourself and see its options.
#linux #logrotate #rotate