Access & Error Logs in Apache

From the Apache cheat sheet ยท Logging ยท verified Jul 2026

Access & Error Logs

Configure log files, formats, and rotation

apacheconf
# Error log
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn

# Access log with combined format
CustomLog ${APACHE_LOG_DIR}/access.log combined
๐Ÿ’ก Use combined format for access logs โ€” it includes Referer and User-Agent for analysis
โšก Set LogLevel rewrite:trace3 to debug mod_rewrite rules โ€” essential when rules don't work
๐Ÿ“Œ Use SetEnvIf to exclude health checks and bots from access logs โ€” keeps logs clean
๐ŸŸข Pipe logs to rotatelogs for automatic rotation without logrotate config
loggingaccess-logerror-log
Back to the full Apache cheat sheet