Answer the question
In order to leave comments, you need to log in
Separate traffic accounting by ip for nginx apache2 bundle
There is a web server running on a bunch of nginx + apache2, a lot of virtual hosts. There is a need to keep a record of traffic for each of the hosts in terms of external traffic / internal traffic. There is a file with ip addresses related to the internal network. There is a nice thing for apache called mod_cband, it would be great for this task, but it has nginx in front of it, which gives up static. Maybe there is a similar module for nginx?
Answer the question
In order to leave comments, you need to log in
First, we write in the config so that nginx writes an access log. This is described here , you just need to add ip to the log, it will be something like this:
log_format trafctr '$request_length $bytes_sent $server_name $remote_addr $time_local';
Then, in any scripting language, write a script that parses this log. This is an easy task, in my opinion.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question