Monitor specific endpoint via Caddy-Prometheus-Grafana

1. The problem I’m having:

I need to count logins per minutes using Caddy metrics and prometheus
as my setup :
Internet → CADDY → NGINX as API GATEWAY → Login API
for that, there is this section in Caddyfile to reverse proxy the login API

customdomain.fr {
        handle /metrics {
                @nope not remote_ip private_ranges
                abort @nope
                metrics
        }
}
api.customdomain.fr {
        handle /metrics {
                @nope not remote_ip private_ranges
                abort @nope
                metrics
        }
        handle {
                reverse_proxy login-API:80
        }
        log {
                output file /var/log/caddy/customdomain.fr-access.log
                format json
        }
        import common
}

https://api.customdomain.fr/api/login is the endpoint responsible for the login
I want to know to get Grafana dashboard for a series of logins per minutes , as Caddy is the first receiving the traffic and can get the status code already.
in other word, I need to have prometheus query for every request have 200 status code for that specific endpoint

2. Error messages and/or full log output:

none

3. Caddy version:

v2.5.2

4. How I installed and ran Caddy:

Docker-compose

a. System environment:

b. Command:

none

You can parse the caddy logfiles. You can enable full json, or create a specific logger with just the info you need.

That’s a very old Caddy version. Please upgrade to the latest, v2.7.5.

Also keep in mind that metrics are now opt-in as of v2.6.0 for performance reasons. See Monitoring Caddy with Prometheus metrics — Caddy Documentation

Unfortunately, metrics don’t track the request path currently, because it’s an unbounded field (there’s infinite possible request paths).

We don’t have any Caddy maintainers that understand or use metrics currently, so we’re not able to make improvements to it. We’re looking for help with that.