What scheme is generally used as a reverse proxy (such as haproxy / nginx) to realize prometheus monitoring request url path?

38 views
Skip to first unread message

kazakaze

unread,
Sep 17, 2021, 6:28:13 AM9/17/21
to Prometheus Users
I have a proxy server, simply, I want to record which URLs are accessed through the proxy server. And hope to use prometheus as monitoring. However, when I was brainstorming, I wonder if prometheus+request-url-path is a good idea.

Brian Candler

unread,
Sep 17, 2021, 7:49:08 AM9/17/21
to Prometheus Users
Prometheus only records metrics, which are numeric values - counters and gauges.

You can apply labels to timeseries, but these are not suitable for storing arbitrary strings like URL paths, because every new URL path you see will create a new timeseries.  It can lead to cardinality explosion, especially if your system is open where attackers can generate arbitrary URL paths.

I suggest you look at a logging solution, like Loki or Elasticsearch.  Loki allows you to apply PromQL-style queries to your logs; Elasticsearch has its own query language and API.

kazakaze

unread,
Sep 17, 2021, 9:39:14 PM9/17/21
to Prometheus Users
thank you for your reply.

My other question is, do I still want to show with grafana? Can the data of the log solution be displayed in grafana? I haven't seen it. What kind of graphics might it be?

Brian Candler

unread,
Sep 18, 2021, 2:52:18 AM9/18/21
to Prometheus Users
Loki is written by the same people as Grafana and integrates tightly.  You can use the "explore" section to view logs, you can create your own panels, and you can use LogQL queries.  But this is off-topic for a prometheus list.
Reply all
Reply to author
Forward
0 new messages