diff --git a/pkg/acquisition/modules/waf/utils.go b/pkg/acquisition/modules/waf/utils.go index 36e177a33..323194737 100644 --- a/pkg/acquisition/modules/waf/utils.go +++ b/pkg/acquisition/modules/waf/utils.go @@ -22,7 +22,7 @@ func TxToEvents(r ParsedRequest, kind string) ([]types.Event, error) { if rule.Message() == "" { continue } - wafRuleHits.With(prometheus.Labels{"rule_id": fmt.Sprintf("%d", rule.Rule().ID()), "type": kind}).Inc() + WafRuleHits.With(prometheus.Labels{"rule_id": fmt.Sprintf("%d", rule.Rule().ID()), "type": kind}).Inc() evt, err := RuleMatchToEvent(rule, r.Tx, r, kind) if err != nil { return nil, errors.Wrap(err, "Cannot convert rule match to event") diff --git a/pkg/acquisition/modules/waf/waf.go b/pkg/acquisition/modules/waf/waf.go index d807d10fd..9488ce9a8 100644 --- a/pkg/acquisition/modules/waf/waf.go +++ b/pkg/acquisition/modules/waf/waf.go @@ -24,7 +24,7 @@ import ( "gopkg.in/yaml.v2" ) -var wafParsingHistogram = prometheus.NewHistogramVec( +var WafParsingHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Help: "Time spent processing a request by the WAF.", Name: "cs_waf_parsing_time_seconds", @@ -33,7 +33,7 @@ var wafParsingHistogram = prometheus.NewHistogramVec( []string{"source"}, ) -var wafReqCounter = prometheus.NewCounterVec( +var WafReqCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_waf_reqs_total", Help: "Total events processed by the WAF.", @@ -41,7 +41,7 @@ var wafReqCounter = prometheus.NewCounterVec( []string{"source"}, ) -var wafRuleHits = prometheus.NewCounterVec( +var WafRuleHits = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "cs_waf_rule_hits", Help: "Count of triggered rule, by rule_id and type (inband/outofband).", @@ -448,7 +448,7 @@ func (r *WafRunner) Run(t *tomb.Tomb) error { log.Infof("Waf Runner is dying") return nil case request := <-r.inChan: - wafReqCounter.With(prometheus.Labels{"source": request.RemoteAddr}).Inc() + WafReqCounter.With(prometheus.Labels{"source": request.RemoteAddr}).Inc() //measure the time spent in the WAF startParsing := time.Now() in, tx, err := processReqWithEngine(r.inBandWaf, request, request.UUID, InBand) @@ -494,7 +494,7 @@ func (r *WafRunner) Run(t *tomb.Tomb) error { } //measure the full time spent in the WAF elapsed := time.Since(startParsing) - wafParsingHistogram.With(prometheus.Labels{"source": request.RemoteAddr}).Observe(elapsed.Seconds()) + WafParsingHistogram.With(prometheus.Labels{"source": request.RemoteAddr}).Observe(elapsed.Seconds()) } } }