General system information: Latest Caddy version, Ubuntu 20.04, using the Caddyfile.
I have some webpages and redirects for which I’d love to count how often they’re being accessed.
I’d be fine with a little log, writing a line with access time and IP of the client into a file.
Currently, I’m using a log parser for these webpages and have their log level set to info, however that’s really not very ressource efficient. Is there a better way to do this in caddy itself?
There’s nothing built-in to do this, but you could write a Caddy plugin in Go to do it.
Parsing Caddy access logs shouldn’t really be inefficient though, you should be able to read the logs as a stream and do something with it as new logs are written.
You could use Caddy’s
net log writer and write a little server-style app that ingests the logs and does stuff with it. That would also be pretty fast if written well.
This topic was automatically closed after 30 days. New replies are no longer allowed.