exec

Execute arbitrary commands

One thing to take note of:

  • Any linefeeds will be removed from the command, so this works fine:
    exec:
      command: |
        docker ps
          -all
          --no-trunc
          --quiet
          --size
    
Field NameDescriptionTypeDefault
input-fieldA field from where data is to be read, meaning JSON is assumedfield-
commandA shell command to be executedstring-
stdinRun the command separately for each eventbooltrue
retryFor operations that could potentially fail--

input-field

A field from where data is to be read, meaning JSON is assumed

Otherwise the whole event is sent

Type: field

Example

input:

{"text":"one","number":1}

action:

exec:
  input-field: text
  command: cat

output:

one

command

A shell command to be executed

If stdin is set to false (or input-field) then there can be field expansions

Type: string

Example

input:

{"text":"one","number":1}

action:

exec:
  command: cat

output:

{"text":"one","number":1}

stdin

Run the command separately for each event

Normally, the command runs continuously and events are passed through

Type: bool

retry

For operations that could potentially fail

Field NameDescriptionTypeDefault
countHow many attempts to make before declaring failureinteger-
pauseHow long to pause before re-tryingduration-
foreverkeep trying until success is declaredboolfalse

count

How many attempts to make before declaring failure

Type: integer

Example

action:

exec:
  command: echo 'one two'
  retry:
    count: 1

output:

{"_raw":"one two"}

pause

How long to pause before re-trying

Accepts human-friendly formats, like 1m (for 1 minute) and 4h (for 4 hours)

Type: duration

Example

action:

exec:
  command: echo 'one two'
  retry:
    count: 6
    pause: 10s

output:

{"_raw":"one two"}

forever

keep trying until success is declared

Accepts human-friendly formats, like 1m (for 1 minute) and 4h (for 4 hours)

Type: bool

Example

action:

exec:
  command: echo 'one two'
  retry:
    forever: true

output:

{"_raw":"one two"}