Skip to content

Commit

Permalink
processing: skip flow events to save memory
Browse files Browse the repository at this point in the history
  • Loading branch information
markuskont committed Apr 13, 2023
1 parent 0e9044e commit 50fd84a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions processing/stream_suricata.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func CorrelateSuricataEvents(c SuricataCorrelateConfig) error {
countCorrPickup int
countTypeMismatch int
countBucketRotates int
countSkippedFlow int
)

bucketsCorr, err := newBuckets(bucketsConfig{
Expand Down Expand Up @@ -131,6 +132,17 @@ func CorrelateSuricataEvents(c SuricataCorrelateConfig) error {
if !ok {
break loop
}
if eventType, ok := eve.GetString("event_type"); ok && eventType == "flow" {
encoded, err := json.Marshal(eve.Raw())
if err != nil {
countErrMarshalJSON++
continue loop
}
c.Output.Client.LPush(context.TODO(), c.Output.Key, encoded)
countSkippedFlow++
continue loop
}

countEvents++
id, ok := eve.GetString("community_id")
if !ok {
Expand Down Expand Up @@ -201,6 +213,7 @@ func CorrelateSuricataEvents(c SuricataCorrelateConfig) error {
WithField("count_correlations_pickup", countCorrPickup).
WithField("count_bucket_err_type_lookup", countTypeMismatch).
WithField("count_bucket_rotates", countBucketRotates).
WithField("count_skipped_flow", countSkippedFlow).
Info("suricata correlation report")
}
}
Expand Down

0 comments on commit 50fd84a

Please sign in to comment.