Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
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.

Nginx virtual host bandwidth control?

dnwkdnwk Member

Is there a way to calculate and control how many bandwidth a vhost consume?

Comments

  • c0yc0y Member

    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

  • @Frost said:
    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

  • c0yc0y Member

    @dnwk said:
    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

  • dnwkdnwk Member
    edited October 2013

    @Frost said:
    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

  • c0yc0y Member
    edited October 2013

    @dnwk said:
    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?

Sign In or Register to comment.