How to configure access log rotation for Tengine
2026-09-29
AdSense Slot
Tengine access log grows quickly and fill disk without rotation. We use Linux logrotate tool.
Create logrotate config file
Create /etc/logrotate.d/tengine
/usr/local/tengine/logs/*.log {
daily
rotate 14
compress
delaycompress
missingok
notifempty
sharedscripts
postrotate
/usr/local/tengine/sbin/nginx -s reload
endscript
}
- daily: rotate every day
- rotate14: keep 14 history log files
- compress: gzip old logs
Test logrotate manually
sudo logrotate -d /etc/logrotate.d/tengine
-d means debug mode, preview action without real file change.
Verify after rotation
Check log folder, old log will be compressed. Tengine reload inside postrotate tells Tengine open new log file.
Common mistake
Forgot reload Tengine after rotation, Tengine keeps writing to old deleted file, disk space still occupied.
Summary
Log rotation is mandatory maintenance task for long-running Tengine web server.
AdSense Slot