bunkerity / bunkerweb

🛡️ Open-source and next-generation Web Application Firewall (WAF)
https://www.bunkerweb.io
GNU Affero General Public License v3.0
6.47k stars 363 forks source link

[FEATURE] Have metrics on bunkerweb #578

Closed lenglet-k closed 4 months ago

lenglet-k commented 1 year ago

What's needed and why ? To monitor bunkerweb it would be interesting to have metrics in opentelemetry format in order to be able to retrieve them by tools like prometheus. This will also allow you to create dashboards and supervision alerts.

It should be understood that the metrics will have to expose information on the internal functioning of bunkerweb, for example, a metric allowing to know the number of requests blocked by service, sourceIp and by plugin:

bunkerweb_waf_blocked_request{service="myservice", plugin="badbehavior", sourceIp="1.1.1.1"} 10 # blocked request by service, plugin, sourceIp
bunkerweb_waf_http_request{service="myservice"} 10 # number of request

beware of the use of labels which can lead to high cardinality and therefore overconsumption of prometheus memory

Implementations ideas (optional) have an exporter that exposes the metrics scrappable by prometheus. With that we can create a dashboard and alerts rules.

TheophileDiot commented 4 months ago

Hi, we have the monitoring PRO plugin that does it now (also the prometheus-exporter one) https://www.bunkerweb.io/blog/post/bunkerweb-pro-prometheus-exporter-grafana