Open DuvelCorp opened 1 month ago
@DuvelCorp: Thanks for opening an issue, it is currently awaiting triage.
In the meantime, you can:
Hello
After a few days, my lapi and caddy/crowdsec seems to work fine. I've got real alerts :
Some of my grafana dashboards works perfectly:
But, still : other dashboard that are supposed to report the IPs banned and their geoloc are not working because I am missing some cs_lapi metrics.
This all what I have :
And thus I am missing a part of those listed in this doc : https://docs.crowdsec.net/docs/next/observability/prometheus/
Local API cs_lapi_route_requests_total : number of calls to each route per method cs_lapi_machine_requests_total : number of calls to each route per method grouped by machines cs_lapi_bouncer_requests_total : number of calls to each route per method grouped by bouncers cs_lapi_decisions_ko_total : number of unsuccessfully responses when bouncers ask for an IP. cs_lapi_decisions_ok_total : number of successfully responses when bouncers ask for an
Any hint please
Hey 👋🏻
We dont provide the actual decisions (ip address and geo location data) via the Prometheus endpoint we only provide metrics about counts (EG: scenarios has trigger X times).
Thing to note is Prometheus will only expose metrics it has counts for so the list you provided has some:
cs_lapi_route_requests_total : number of calls to each route per method
cs_lapi_machine_requests_total : number of calls to each route per method grouped by machines
However I dont see the ones below:
cs_lapi_bouncer_requests_total : number of calls to each route per method grouped by bouncers
cs_lapi_decisions_ko_total : number of unsuccessfully responses when bouncers ask for an IP.
cs_lapi_decisions_ok_total : number of successfully responses when bouncers ask for an IP.
So the question is do you have a remediation component (bouncers) interfacing with this machine LAPI?
@LaurenceJJones Thank you for your answer.
If that was not clear I obviously have a bouncer embedded in Caddy using custom built image this https://github.com/hslatman/caddy-crowdsec-bouncer
But now that you state that you dont expose this metric I have understood my mistake
I imported this dashboard in Grafana : https://grafana.com/grafana/dashboards/21689-crowdsec-cyber-threat-insights/ And I didnt read the doc correctly. They use a VictoriaMetrics component between Crowdsec and prometheus to enrich crowdsec metrics with notably Geoip, and they label it "_cs_lapidecision" : https://freefd.github.io/articles/8_cyber_threat_insights_with_crowdsec_victoriametrics_and_grafana/
{
"metric": {
"__name__": "cs_lapi_decision",
"instance": "host00.domain.tld",
"country": "SG",
"asname": "Tencent Building, Kejizhongyi Avenue",
"asnumber": "132203",
"latitude": "1.2868",
"longitude": "103.8503",
"iprange": "129.226.0.0/16",
"scenario": "crowdsecurity/ssh-slow-bf",
"type": "ban",
"duration": "4h",
"scope": "Ip",
"ip": "129.226.84.230"
},
"values": [1],
"timestamps": [1723013301000]
}
My mistake was that seing the name, I had expected that this was coming directly from Crowdsec metrics. Sorry for the useless bug report :-)
On a side note, its a bit over killing to setup an additional metric component like Victoria to enrich and serve that information, considering that all data needed, including Maxmind GeoIP, is already available in Crowdsec LAPI. So I hope you will consider to add that kind of metrics at some point, as it is extremely helpful... and you can turn my bug report into a feature request !
What happened?
Just installed Crowdsec for Caddy. Everything seems to work fine I triggered myself from a VPN IP an alert by scanning manually several sensitive files, and I got banned as expected :
Prometheus seems to retrieve correctly most of crowdsec metrics :
However I dont get any metric cs_lapi_decision According to me I should have received it as there is an active decision on-going. This prevent me to add a list of banned IPs and their Geomap in Grafana, which probably the most important information.
Is there something I missed?
What did you expect to happen?
Get metric data cs_lapi_decision
How can we reproduce it (as minimally and precisely as possible)?
I dont know
Anything else we need to know?
No response
Crowdsec version
OS version
Enabled collections and parsers
Acquisition config
Config show
Prometheus metrics
Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.