Skip to main content
Version: 3.3.0

Action Inputs

Inputs can be run as actions under some conditions. The first thing to note is that when run as actions they may refer to the input data using field expansions.

For example, two numbers are passed to a web service running on port 3030, and it returns their sum as {"sum":<num>}. We can call this web service on our data as follows:

name: adder
input:
text: '{"x":10,"y":20}'
actions:
- input:
http-poll:
address: http://127.0.0.1:3030
raw: true
query:
- a: ${x}
- b: ${y}
output:
write: console
# {"x":10,"y":20,"sum":30}

action-input takes an event, allows field expansions using that event, and finally merges the result of the input with the event.

In the above example we say raw: true, since the web service returns JSON.
If it returned a simple number, we would need raw: false to quote the result and we would get {"x":10,"y":20,"_raw":"30"}.

note

We could've used address: 'http://127.0.0.1:3030?a=${x}&b=${y}' but query makes it easier to build more complex URIs.

These inputs may not be scheduled since they run when data arrives - they are implicitly scheduled by the event stream.
For instance, interval: 2m on the above http-poll is an error.

Inputs that are not schedulable cannot be used, because they are externally scheduled by data arriving, such as tcp,udp and http-server, or subscribing to data streams with amqp or redis.

Although you can use input-exec as an action, it is easier to use action-exec.