procpipe

package
v0.0.0-...-ec225f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultMaxLogSize is the max buffer sized used
	// if MaxLogSize is not set
	DefaultMaxLogSize = 1024 * 1024

	DefaultIntervalSeconds = 60
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

type BaseConfig struct {
	ExecFile      string                 `mapstructure:"exec_file,omitempty"`
	MaxLogSize    helper.ByteSize        `mapstructure:"max_log_size,omitempty"`
	AddAttributes bool                   `mapstructure:"add_attributes,omitempty"`
	Encoding      helper.EncodingConfig  `mapstructure:",squash,omitempty"`
	Multiline     helper.MultilineConfig `mapstructure:"multiline,omitempty"`
	Source        string                 `mapstructure:"source"`
	SourceType    string                 `mapstructure:"sourcetype"`
	Interval      string                 `mapstructure:"interval"`
}

BaseConfig is the detailed configuration of a tcp input operator.

type Commander

type Commander struct {
	// contains filtered or unexported fields
}

Commander can start/stop/restat the Agent executable and also watch for a signal for the Agent process to finish.

func NewCommander

func NewCommander(logger *zap.Logger, execFilePath string, stdout io.Writer, args ...string) (*Commander, error)

func (*Commander) Done

func (c *Commander) Done() <-chan struct{}

Done returns a channel that will send a signal when the Agent process is finished.

func (*Commander) ExitCode

func (c *Commander) ExitCode() int

ExitCode returns Agent process exit code if it exited or 0 if it is not.

func (*Commander) IsRunning

func (c *Commander) IsRunning() bool

func (*Commander) Pid

func (c *Commander) Pid() int

Pid returns Agent process PID if it is started or 0 if it is not.

func (*Commander) Restart

func (c *Commander) Restart(ctx context.Context) error

func (*Commander) Start

func (c *Commander) Start(ctx context.Context) error

Start the Agent and begin watching the process. Agent's stdout and stderr are written to a file.

func (*Commander) Stop

func (c *Commander) Stop(ctx context.Context) error

Stop the Agent process. Sends SIGTERM to the process and wait for up 10 seconds and if the process does not finish kills it forcedly by sending SIGKILL. Returns after the process is terminated.

type Config

type Config struct {
	helper.InputConfig `mapstructure:",squash"`
	BaseConfig         `mapstructure:",squash"`
}

Config is the configuration of a stdin input operator.

func NewConfig

func NewConfig() *Config

NewConfig creates a new stdin input config with default values

func (*Config) Build

func (c *Config) Build(logger *zap.SugaredLogger) (operator.Operator, error)

Build will build a stdin input operator.

type Input

type Input struct {
	helper.InputOperator
	MaxLogSize int
	// contains filtered or unexported fields
}

Input is an operator that reads input from stdin

func (*Input) Start

func (g *Input) Start(_ operator.Persister) error

Start will start generating log entries.

func (*Input) Stop

func (g *Input) Stop() error

Stop will stop generating logs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL