Skip to content

Commit

Permalink
Allow configuring MaxLogSize for namedpipe input
Browse files Browse the repository at this point in the history
This allows the user to configure the maximum size of a log line, rather
than always using the default.

Signed-off-by: sinkingpoint <[email protected]>
  • Loading branch information
sinkingpoint committed Nov 10, 2023
1 parent 214b0ba commit 9d5a726
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/stanza/operator/input/namedpipe/namedpipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type BaseConfig struct {
Encoding string `mapstructure:"encoding"`
SplitConfig split.Config `mapstructure:"multiline,omitempty"`
TrimConfig trim.Config `mapstructure:",squash"`
MaxLogSize int `mapstructure:"max_log_size"`
}

// Build will build a namedpipe input operator.
Expand All @@ -67,10 +68,15 @@ func (c *Config) Build(logger *zap.SugaredLogger) (operator.Operator, error) {
return nil, fmt.Errorf("failed to create split function: %w", err)
}

maxLogSize := c.MaxLogSize
if maxLogSize == 0 {
maxLogSize = DefaultMaxLogSize
}

return &Input{
InputOperator: inputOperator,

buffer: make([]byte, DefaultMaxLogSize),
buffer: make([]byte, maxLogSize),
path: c.Path,
permissions: c.Permissions,
splitFunc: splitFunc,
Expand Down

0 comments on commit 9d5a726

Please sign in to comment.