← Stack Garden

Log rotation for containers that write to files

Containers that log to a bind-mounted file keep the old inode open after rotation. Either signal the process or use copytruncate and accept losing a few lines.

/srv/app/logs/*.log {
  daily
  rotate 14
  compress
  copytruncate
}