First of all, thanks to everyone associated to the Caddy project - cracking piece of software which we have been using for a couple of years now.
We’re using Caddy to create and manage certificates and to push traffic to our CMS platform and its working great. We’ve recently set up a platform for us to manage the Caddy server JSON config plus an API so our CMS platform can make changes directly to the Caddy config - all working great.
What I’d like to do next is measure the bandwidth coming from each domain through the Caddy server, I’ve been looking at the logging available and before I go down that route and try to do something just wondering if anyone else has done this and what process they followed? Reason being I want to be able to track the usage per domain over the last 30 days.
Thanks both for the quick responses. I was going to look at the HTTP Middleware metrics, not sure if this is the right place?
To explain a bit further, we have multiple endpoints where the traffic may be forwarded to and each endpoint has one or more domains, if the request comes from a matched domain the traffic is proxied to that endpoint.
I’ll take another look at the logs to see if I can work this one out further.
The tricky bit is Caddy doesn’t actually read the request body or know how long it is until it’s being read or copied for some other purpose, such as reverse_proxy to send it upstream, or some other HTTP handler which might do processing inside of Caddy itself.
So basically the request body reader will need to be wrapped with a type that will counts the bytes as they’re being read.
We already have a feature request open for this, see here: