Keep log file size fixed without logrotate
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
:
-c, --bytes=N
output the last N bytes; alternatively, use +N to output bytes
starting with the Nth of each file
If the first character of N (the number of bytes or lines) is a `+',
print beginning with the Nth item from the start of each file, other‐
wise, print the last N items in the file. N may have a multiplier suf‐
fix: b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024, GB
1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.