Exec

Example Configuration

Exec line

Config
Input
Output
1[sources.my_source_id]
2type = "exec"
1"64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.060 ms"
1{
2 "log": {
3 "data_stream": "stdout",
4 "pid": 5678,
5 "timestamp": "2020-03-13T20:45:38.119Z",
6 "host": "my-host.local",
7 "message": "64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.060 ms"
8 }
9}

Configuration Options

Required Options

mode(required)

The type of exec mechanism.

TypeSyntaxDefaultExample
stringliteral["scheduled","streaming"]
command(required)

The command to be run, plus any arguments required.

TypeSyntaxDefaultExample
arrayliteral[["echo","Hello World!"],["ls","-la"]]
type(required)

The component type. This is a required field for all components and tells Vector which component to use.

TypeSyntaxDefaultExample
stringliteral["exec"]

Advanced Options

working_directory(optional)

The directory in which to run the command.

TypeSyntaxDefaultExample
stringliteral
include_stderr(optional)

Include the output of stderr when generating events.

TypeSyntaxDefaultExample
bool
event_per_line(optional)

Determine if events should be generated per line or buffered and output as a single event when script execution finishes.

TypeSyntaxDefaultExample
bool
maximum_buffer_size_bytes(optional)

The maximum buffer size allowed before a log event will be generated.

TypeSyntaxDefaultExample
uint1000000
scheduled(optional)

The scheduled options.

TypeSyntaxDefaultExample
hash[]
streaming(optional)

The streaming options.

TypeSyntaxDefaultExample
hash[]

How it Works

Line Delimiters

Each line is read until a new line delimiter, the 0xA byte, is found or the end of the maximum_buffer_size_bytes is reached.

State

This component is stateless, meaning its behavior is consistent across each input.

Context

By default, the exec source augments events with helpful context keys.