How can I troubleshoot my crowdsec daemon due to high RAM usage?
For RAM, currently it is 12G in total and is growing.
I have used pprof and were shocked - 8GB is consumed by github.com/crowdsecurity/crowdsec/pkg/leakybucket.NewQueue
Is it possible to lower its’ memory consumption? cache_size: 1 from scenario configuration might be useful for me, but unfortunately it hurts notification feature, thus it is not suitable for me:
Cache size will affect the number of events you receive within an alert.
It would not do the job for me because I won’t receive all 4 or 128 events in a notification webhook.
I need all 4 or 128 events because depending on attacker, they might generate 4 connection to distinct DstIP:DstPort pairs within long time frame or faster but to the single destination. To prevent false positives, I wait for 128 connections if distinctconn scenario haven’t fired.
Then there nothing to troubleshoot, you either need to narrow down the capacity to smaller amount / leakspeed else it will hold all 128 events in memory leading to high consumption.