7

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 1335941116|261|322|user-4263|127.0.0.1|/1.1/user/downloading 

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?

2 Answers 2

8

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.

0

For anyone coming here years later... The link in the accepted answer is dead. The new link is https://nginx.org/en/docs/http/ngx_http_log_module.html#log_format

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.