Search code examples
nginxaccess-log

How to log the Range header info in client requests to NGINX in Access Log


I want to log what is in the Range header in requests sent to Nginx, in Access Log if possible. How to do that?


Solution

  • You can use something like this

    log_format myrange '$remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_range"';
    
    server {
        ...
        access_log /var/log/nginx/custom_range.log myrange;
    }