exec

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

README

Exec Processor Plugin

The exec processor executes configured command on each event.

Configuration

[[processors]]
  [processors.exec]
    # the command that will be executed
    command = "bash"

    # list of fields that values will be used as command args
    # if field is []any, plugin adds each entry to args list
    # if field is map[string]any, plugin adds each key
    # and it's value to args list
    # otherwise, field will be used as is
    args = []

    # path to set process exit code
    exec_code_to = "exec.code"

    # path to set process combined output
    exec_output_to = "exec.output"

    # a "env name <- label" map
    # each configured will be added to the environment 
    # of the process in the "env_name=label_value" form
    [processors.exec.envlabels]
      CATCH_PHRASE = "phrase"

Example

# simple echo
{
  "routing_key": "exec.bash.echo",
  "labels": {
    "phrase": "Hi, I'm Elfo"
  },
  "data": [
    "-c",
    "echo $CATCH_PHRASE"
  ]
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exec

type Exec struct {
	*core.BaseProcessor `mapstructure:"-"`
	Command             string            `mapstructure:"command"`
	Timeout             time.Duration     `mapstructure:"timeout"`
	Args                []string          `mapstructure:"args"`
	ExecCodeTo          string            `mapstructure:"exec_code_to"`
	ExecOutputTo        string            `mapstructure:"exec_output_to"`
	EnvLabels           map[string]string `mapstructure:"envlabels"`
}

func (*Exec) Close

func (p *Exec) Close() error

func (*Exec) Init

func (p *Exec) Init() error

func (*Exec) Run

func (p *Exec) Run()

Jump to

Keyboard shortcuts

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