inputexec

package
v0.0.0-...-5039c01 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 12 Imported by: 3

README

gogstash input exec

Synopsis

{
	"input": [
		{
			"type": "exec",

			// (required)
			"command": "",

			// (optional), default: []
			"args": [""],

			// (optional), in seconds, default: 60
			"interval": 60
		}
	]
}

Details

  • type
    • Must be "exec"
  • command
    • Command to run. For example, “uptime”
  • args
    • String array
    • Arguments of command
  • interval
    • Interval to run the command. Value is in seconds.

Documentation

Index

Constants

View Source
const ErrorTag = "gogstash_input_exec_error"

ErrorTag tag added to event when process module failed

View Source
const ModuleName = "exec"

ModuleName is the name used in config file

Variables

View Source
var (
	ErrorExecCommandFailed1 = errutil.NewFactory("run exec failed: %q")
)

errors

Functions

func InitHandler

func InitHandler(
	ctx context.Context,
	raw config.ConfigRaw,
	control config.Control,
) (config.TypeInputConfig, error)

InitHandler initialize the input plugin

func IsMsgType

func IsMsgType(s string) bool

Types

type InputConfig

type InputConfig struct {
	config.InputConfig
	Command   string   `json:"command"`                  // Command to run. e.g. “uptime”
	Args      []string `json:"args,omitempty"`           // Arguments of command
	Interval  int      `json:"interval,omitempty"`       // Second, default: 60
	MsgTrim   string   `json:"message_trim,omitempty"`   // default: " \t\r\n"
	MsgPrefix string   `json:"message_prefix,omitempty"` // only in text type, e.g. "%{@timestamp} [uptime] "
	MsgType   MsgType  `json:"message_type,omitempty"`   // default: "text"
	// contains filtered or unexported fields
}

InputConfig holds the configuration json fields and internal objects

func DefaultInputConfig

func DefaultInputConfig() InputConfig

DefaultInputConfig returns an InputConfig struct with default values

func (*InputConfig) Start

func (t *InputConfig) Start(ctx context.Context, msgChan chan<- logevent.LogEvent) (err error)

Start wraps the actual function starting the plugin

type MsgType

type MsgType int8
const (
	MsgTypeText MsgType = 1 + iota
	MsgTypeJson
)

func ParseMsgType

func ParseMsgType(s string) MsgType

func (MsgType) MarshalJSON

func (t MsgType) MarshalJSON() ([]byte, error)

func (*MsgType) Scan

func (t *MsgType) Scan(value any) (err error)

func (MsgType) String

func (t MsgType) String() string

func (*MsgType) UnmarshalJSON

func (t *MsgType) UnmarshalJSON(b []byte) (err error)

func (MsgType) Value

func (t MsgType) Value() (v driver.Value, err error)

Jump to

Keyboard shortcuts

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