Aqua Blue Network

Keeping nginx logs small and useful

August 2026

The default combined format is fine until you try to answer a question with it. I ended up with a shorter format that keeps what I actually search for.

log_format main '$remote_addr - [$time_local] "$request" $status $body_bytes_sent '
                '"$http_referer" "$http_user_agent"';

Rotation

The packaged logrotate rule rotates daily and keeps two weeks, compressed. That is enough for a small site. The one thing worth checking is that the postrotate step really signals nginx; otherwise it keeps writing to the renamed file.

What not to log

Health checks and static assets drown out everything else. Switching access_log off for those locations makes the remaining lines much easier to read.