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 Output Plugin

The exec output executes configured command on each event.

Configuration

[[outputs]]
  [outputs.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 = ["."]

    # a "env name <- label" map
    # each configured will be added to the environment 
    # of the process in the "env_name=label_value" form
    [outputs.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.BaseOutput `mapstructure:"-"`
	Command          string            `mapstructure:"command"`
	Timeout          time.Duration     `mapstructure:"timeout"`
	Args             []string          `mapstructure:"args"`
	EnvLabels        map[string]string `mapstructure:"envlabels"`
}

func (*Exec) Close

func (o *Exec) Close() error

func (*Exec) Init

func (o *Exec) Init() error

func (*Exec) Run

func (o *Exec) Run()

Jump to

Keyboard shortcuts

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