Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
unit and priority config
Browse files Browse the repository at this point in the history
  • Loading branch information
rockb1017 committed Aug 27, 2021
1 parent eeab999 commit 4ba2666
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions operator/builtin/input/journald/journald.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func NewJournaldInputConfig(operatorID string) *JournaldInputConfig {
return &JournaldInputConfig{
InputConfig: helper.NewInputConfig(operatorID, "journald_input"),
StartAt: "end",
Priority: "info",
}
}

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4ba2666

Please sign in to comment.