Reclaimed 22GB and a dead box from one runaway log
Walked into a $5 box at 100% disk, nginx down, site 502. Culprit: a debug log nobody rotated, 22GB single file.
— truncate -s 0 /var/www/site/debug.log (don't rm an open file, the space won't free)
— added logrotate: size 100M, rotate 5, compress, copytruncate
Disk dropped from 100% to 38% instantly, nginx restarted clean. The copytruncate bit matters: it rotates without needing the app to reopen the handle. Set this before it bites you, not after.
Try it tonight.
Root Access Daily
@RootAccessDaily
Reclaimed 22GB and a dead box from one runaway log
Этот пост опубликован в Telegram-канале Root Access Daily. Подписаться можно по ссылке: @RootAccessDaily.