Upstart not reopening log files on logrotation
I believe you have 3 options.
-
You modify the existing configuration by adding "copytruncate"
/var/log/upstart/*.log { copytruncate daily missingok rotate 7 compress notifempty nocreate }
If you can't or (are not allowed) to change the existing logrotate config because of other log files that don't suffer and the existing config works for them, then move your "SERVICE_NAME.log" files to a new folder under /var/log if your wish, create a new config with the "copytruncate" and add it to the cron.daily.
a) If you're not allowed to change the host os logrotate config or add to the host OS's cron.daily, then your third option is to change the scripts or programs to either check that the file exists before writing out to the file. b) Another way is a bit of point 2 above which is to move your logfiles somewhere else and within you script or program, execute the logrotate command specific for that program's logfile.
Point 3b above is more tricky but more elegant and it is what I use most of the time as it means the program is self-sufficient and self-managed and doesn't need the OS's jobs to babysit it.
To find out how to manually run logrotate and add it to your program or script just type:
man logrotate
or
logrotate --help
If you are using Python for your programs you can check out how this program uses it to self-manage its log files. http://bazaar.launchpad.net/~ferncasado/keep.awake/trunk/files/head:/v4/