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 Name | Description | Type | Default |
---|---|---|---|
input-field | pass the data in this field through the command | string | - |
command | A shell command to be executed | string | - |
result | Offers a way to collect the full output of a command: stdout, stdin, and exit status | - | - |
input-field
pass the data in this field through the command
otherwise all of the input is passed. This also happens if the field exists but is not text.
Type: string
Example: pass value of _raw
through the tr
command and store in out
input:
{"_raw":"hello dolly"}
action:
exec:
command: tr 'h' 'H'
input-field: _raw
result:
stdout-field: out
output:
{"_raw":"hello dolly","out":"Hello dolly"}
command
A shell command to be executed
without 'result' all output will be discarded; the command is just run for its side effects
Type: string
Example: append value of msg
to a log file
input:
{"msg":"hello dolly"}
action:
exec:
command: cat ${msg} >> log.txt
result
Offers a way to collect the full output of a command: stdout, stdin, and exit status
these generated fields are merged with the existing fields
Field Name | Description | Type | Default |
---|---|---|---|
stdout-field | Field where stdout of command will be stored | field | - |
stderr-field | Field where stderr of command will be stored | field | - |
status-field | Field where exit staus of command will be stored | field | - |
stdout-field
Field where stdout of command will be stored
The output will be discarded if this field is not specified
Type: field
Example
input:
{"one":1,"two":2}
action:
exec:
command: echo ${one} and ${two}
result:
stdout-field: stdout
output:
{"one":1,"two":2,"stdout":"1 and 2"}
stderr-field
Field where stderr of command will be stored
Type: field
Example
input:
{"one":1,"two":2}
action:
exec:
command: "echo \"return with an error\" 1>&2 && false"
result:
stderr-field: stderr
output:
{"one":1,"two":2,"stderr":"return with an error"}
status-field
Field where exit staus of command will be stored
Type: field
Example
input:
{"one":1,"two":2}
action:
exec:
command: echo ${one} and ${two}
result:
status-field: status
output:
{"one":1,"two":2,"status":0}