I am running a daemon process that will have to run indefinitely (a 'service' so to speak) and wish to log its output. A simple solution like:
./long-running-process > log.out &
... fails as the file log.out
:
- soon exceeds the size that I can easily handle with a text editor like
emacs
orvi
- runs the risk of depleting free file system space.
To keep the size of the log file manageable I could use the split
bash command:
./long-running-process | split -l 30000
This solution keeps the log files it creates manageable in size however it can run out of suffixes (split: output file suffixes exhausted
) or, if the suffix space is huge, it may also deplete file system space.
So I am looking at a solution that will generate a number of log files, with each log file being manageable in size, and will also rotate amongst them so that there is a ceiling on the total disk space that will be claimed.
Is there such a solution available or do I have to implement it at the application level?
logrotate
in another word ?