My naive caddy metrics exporter for prometheus.
Simulate a log entry append from caddy
echo "{\"level\":\"info\",\"ts\":1692530118.2489564,\"logger\":\"http.log.access.log1\",\"msg\":\"handled request\",\"request\":{\"method\":\"POST\",\"host\":\"i.waalrus.xyz\",\"uri\":\"/upload\"},\"bytes_read\":0,\"user_id\":\"\",\"duration\":0.0013632,\"size\":12640,\"status\":404}" >> sample.log
go to matchers.rs and define them like shown in init
.
git clone https://github.com/mWalrus/caddy-metrics /usr/local/caddy-metrics
Add this to each of your host blocks in your Caddyfile:
log {
output file /var/log/caddy/requests.log
format json
}
Run ./install.sh
in the project root.