logfiles
Log file Handling
If a log file is too large and it cannot be deleted, truncate it:
truncate -s 0 /path/to/logfile
For larger files this might take some time. The 'trick' is also used by logrotate copytruncate
Hint: it might be possible that
ls -l logfile
still shows the wrong size, but a du -h in the folder is correct.
Logroate
For services that cannot handle new file descriptors (old log file was closed, moved and a new was opened) it is mandatory to use
copytruncate
in the logrotate settings for a service! With this setting, the log file is copied to the “backup” and when this is done, the original log file, same descriptor, is truncated to a size of zero.
Keywords: logfile large disk space hd truncate logrotate
logfiles.txt · Last modified: 2024/04/11 14:23 by 127.0.0.1