Is there any way to keep file size of log file fixed without rotating it by a new empty file and deleting (or archiving) the old file. For example, if I set log file maximum size to 1MB, after the file size increase beyond that limit it will be automatically clamped, the text is added on 'tail' and the oldest part of text is poped out to keep the file size 1MB.
Keep Log File Size Fixed Without Using Logrotate
fileslogrotatelogssize;
Best Answer
You could write a little bash script to do this. Just tail the file to a certain byte count using
tail -c
and overwrite the file.from
man tail
: