My Play Framework logrotate configuration

Here is another script I need to keep handy for the future. My logrotate script for Play Framework applications. The important thing here is the parameter “copytruncate”. I tried many times without it and the result was always the same: after the logrotate was done no more logging was made by the application. “copytruncate” solved this

1/opt/myapp/logs/*.log {
2  missingok
3  notifempty
4  size 50M
5  copytruncate
6  create 0644 root root
7  rotate 9999
8}

How to run logrotate manually:

1logrotate --force /etc/logrotate.d/myapp

Tested on Ubuntu 14.04 and Play Framework 2.3

Comments are closed.