From 4ba26663f20ed5b8fedfb97e6c97defcc30b5a26 Mon Sep 17 00:00:00 2001 From: rockb1017 Date: Fri, 27 Aug 2021 13:53:46 -0700 Subject: [PATCH] unit and priority config --- operator/builtin/input/journald/journald.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/operator/builtin/input/journald/journald.go b/operator/builtin/input/journald/journald.go index 9c90c6ae..1d490f70 100644 --- a/operator/builtin/input/journald/journald.go +++ b/operator/builtin/input/journald/journald.go @@ -44,6 +44,7 @@ func NewJournaldInputConfig(operatorID string) *JournaldInputConfig { return &JournaldInputConfig{ InputConfig: helper.NewInputConfig(operatorID, "journald_input"), StartAt: "end", + Priority: "info", } } @@ -54,6 +55,8 @@ type JournaldInputConfig struct { Directory *string `mapstructure:"directory,omitempty" json:"directory,omitempty" yaml:"directory,omitempty"` Files []string `mapstructure:"files,omitempty" json:"files,omitempty" yaml:"files,omitempty"` StartAt string `mapstructure:"start_at,omitempty" json:"start_at,omitempty" yaml:"start_at,omitempty"` + Units []string `mapstructure:"units,omitempty" json:"units,omitempty" yaml:"units,omitempty"` + Priority string `mapstructure:"priority,omitempty" json:"priority,omitempty" yaml:"priority,omitempty"` } // Build will build a journald input operator from the supplied configuration @@ -82,6 +85,12 @@ func (c JournaldInputConfig) Build(buildContext operator.BuildContext) ([]operat return nil, fmt.Errorf("invalid value '%s' for parameter 'start_at'", c.StartAt) } + for _, unit := range c.Units { + args = append(args, "--unit=", unit) + } + + args = append(args, "--priority", c.Priority) + switch { case c.Directory != nil: args = append(args, "--directory", *c.Directory)