I'm changing my server from Apache to Nginx. Nginx will only serve static files and proxy to apache for dynamic files and to NodeJS for exhausting working. With my initial implementation in Apache I have some custom log to get informed of how many data I send and receive.

CustomLog /var/log/apache2/traffic-access.log "%{%s}t|%O|%I|%{Referer}i|%a|%U"

This custom log generate this log example:

Timestamp|bytes sent|bytes received|user agent|IP|URL request


I would like to migrate this custom log to Nginx and try to change the less as I can my internal scripts of getting traffic data.

I want to maintain the 2 logs the main log and traffic log.

I'm starting with this custom log:

http {

log_format traffic '$msec|$bytes_sent|$request_length???|$http_user_agent|$remote_addr|$request_filename';

access_log  logs/access.log  main;
access_log  logs/traffic.log traffic

Is the request_length the bytes user send to the server?


Yes, the $request_length is the length of the body of the request sent by user to the server. You can visit this link for other values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.