Thibault bui Koechlin 5 years ago
parent
commit
4b0058d09a
1 changed files with 4 additions and 4 deletions
  1. 4 4
      cmd/crowdsec/parse.go

+ 4 - 4
cmd/crowdsec/parse.go

@@ -34,9 +34,9 @@ LOOP:
 			}
 			}
 			if cConfig.Profiling {
 			if cConfig.Profiling {
 				atomic.AddUint64(&linesReadOK, 1)
 				atomic.AddUint64(&linesReadOK, 1)
-				globalParserHits.With(prometheus.Labels{"source": event.Line.Src}).Inc()
-
 			}
 			}
+			globalParserHits.With(prometheus.Labels{"source": event.Line.Src}).Inc()
+
 			/* parse the log using magic */
 			/* parse the log using magic */
 			parsed, error := parser.Parse(parserCTX, event, nodes)
 			parsed, error := parser.Parse(parserCTX, event, nodes)
 			if error != nil {
 			if error != nil {
@@ -45,17 +45,17 @@ LOOP:
 			}
 			}
 			if !parsed.Process {
 			if !parsed.Process {
 				if cConfig.Profiling {
 				if cConfig.Profiling {
-					globalParserHitsKo.With(prometheus.Labels{"source": event.Line.Src}).Inc()
 					atomic.AddUint64(&linesParsedKO, 1)
 					atomic.AddUint64(&linesParsedKO, 1)
 				}
 				}
+				globalParserHitsKo.With(prometheus.Labels{"source": event.Line.Src}).Inc()
 				log.Debugf("Discarding line %+v", parsed)
 				log.Debugf("Discarding line %+v", parsed)
 				discardCPT++
 				discardCPT++
 				continue
 				continue
 			}
 			}
 			if cConfig.Profiling {
 			if cConfig.Profiling {
-				globalParserHitsOk.With(prometheus.Labels{"source": event.Line.Src}).Inc()
 				atomic.AddUint64(&linesParsedOK, 1)
 				atomic.AddUint64(&linesParsedOK, 1)
 			}
 			}
+			globalParserHitsOk.With(prometheus.Labels{"source": event.Line.Src}).Inc()
 			processCPT++
 			processCPT++
 			if parsed.Whitelisted {
 			if parsed.Whitelisted {
 				log.Debugf("event whitelisted, discard")
 				log.Debugf("event whitelisted, discard")