From ff7acd334740c10d2d0ea2ab99395e0f1b8e0d61 Mon Sep 17 00:00:00 2001 From: Laurence Jones Date: Fri, 13 Oct 2023 12:53:42 +0100 Subject: [PATCH] Reset grokky once all patterns are compiled as we do not need to hold them in memoory (#2420) --- pkg/parser/unix_parser.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/parser/unix_parser.go b/pkg/parser/unix_parser.go index a6992befe..2e4a8035b 100644 --- a/pkg/parser/unix_parser.go +++ b/pkg/parser/unix_parser.go @@ -148,6 +148,12 @@ func LoadParsers(cConfig *csconfig.Config, parsers *Parsers) (*Parsers, error) { parsers.Ctx.Profiling = true parsers.Povfwctx.Profiling = true } - + /* + Reset CTX grok to reduce memory footprint after we compile all the patterns + */ + parsers.Ctx.Grok = grokky.Host{} + parsers.Povfwctx.Grok = grokky.Host{} + parsers.StageFiles = []Stagefile{} + parsers.PovfwStageFiles = []Stagefile{} return parsers, nil }