I am writing a program that is designed to never terminate, It will also produce large logs (files) of what it is doing. What I would like is for a linux process to periodically (every X minutes (cronjob?)) :
- Take the current logs from the current log file
- place them in a separate file (appropriately named) for offline storage / removal
- Truncate the current logfile so data is not duplicated.
All without data loss or interruption to the producing program. So that I end up with a sequence of time delimeted logs
Is there a Linux utility or known solution for this ? or should I build this logging functionality into the program ?
systemd, Upstart,daemontools,runit,...) handle logging. – sr_ Apr 11 '12 at 10:48