Where to find web access logs? Looking for a log of all http/https requests hitting your site? You've come to the right place.
Location
All Nginx logs will exist within `mdoq/var/log/nginx`, there are multiple files within this directory.
The naming convention for these files is: [SERVER_NAME].[PORT].[LOG TYPE].log
For example, if your site has the domain www.example.com, you would find the following:
- www.example.com.443.access.log
- www.example.com.443.error.log
- www.example.com.http.access.log
- www.example.com.http.error.log
- www.example.com.8080.access.log
- www.example.com.8080.error.log
Access logs for port 443, are requests served via https.
Access logs for port http, are requests served via http.
Access logs for port 8080, are requests passed to varnish (more on this below).
Each domain and port is further split out to error and access logs, which are exactly as they suggest.
N.B Files starting with `_` are requests that hit your server for a domain that isn't configured.
Request Flow
Here we can see that if we want to see requests that hitting Magento (i.e not in Varnish) we need to look at the 8080 log.
Rotation
All mail logs are rotated nightly.
Previously rotated logs are compressed after one day.
Previously rotated and compressed logs are removed after 14 days.
Web Log IP Addresses
If you are using a Web Application Firewall such as Cloudflare then your web logs may be misreporting the customer IP, in this case you can configure Nginx to log the customer IP by following this article.