New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
yes, a dirty but recommended solution is using the built-in logger and making it log the content sizes, to then parse it and count it up
yes. Too complicated. Any existing solution? even paid solution using PHP
You can probably pay someone to configure the logging for you and write some kind of daemon
Do you know any existing PHP scripts that will parse a log file?
I guess maybe I will start with readline
You can define your own log format: http://wiki.nginx.org/HttpLogModule
Use something like:
log_format '$bytes_sent';
access_log /tmp/nginx-bandmon/example.com;
Then just explode them by new line in PHP and use a for loop to count them up in one variable and you'll have the amount of OUTGOING bytes (without header size I believe)
Also, you might want to prune the file right after reading it to prevent 10GB log files :-)
By the way, do you know if there is a way to store Log in Mysql?
Look at this: http://nginxlimitproxy.sourceforge.net/