Search code examples
ruby-on-railsamazon-web-servicesbandwidthsaasusage-statistics

Measure SAAS App Bandwidth Usage


I am in the process of building a Ruby on Rails based SaaS app. The app is being hosted on AWS (Amazon).

I need to measure the bandwidth usage by each customer for billing and customer segmenting. The customers could be identified by their Urls. like customer1.myapp.com or mycustomer.com

Can somebody suggest the best way to accomplish this? Any tools or simple hacks would be appreciated.


Solution

  • Assuming you are fronting your Rails app with Nginx or Apache, you could use a log format that includes the vhost, then pull out the bytes transferred and the vhost from the log lines (nightly, monthly, or whatever). Add up the bytes, grouping by vhost, and there you go.