inputexec

package
v0.0.0-...-7697303 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2017 License: LGPL-3.0 Imports: 13 Imported by: 0

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) (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 interface{}) (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