serve Make events available under the /serve
REST API
endpoint .
serve id : string, [buffer_size = int]
Description The serve
operator bridges between pipelines and the corresponding /serve
REST API endpoint :
eyJ2ZXJzaW9uIjoiMSIsImVuY29kaW5nIjoiYnN0cmluZyIsImNvbXByZXNzZWQiOnRydWUsImVuY29kZWQiOiJ4nO1Z2VLbSFx1MDAxNH3nKyjPKyi9L3mzg1x0TFx1MDAxMsJiXHUwMDA3yEyKXHUwMDEyUtvWIEtCkllC8e/TkrG1WF5cdTAwMDA7eGpcIqqwfbvVfVt9z7nntlx1MDAxZTY2N2vxfaBq7zdr6s4yXcdcdTAwMGXN29pWYr9RYeT4nm5C6e/IXHUwMDFmhFbas1x1MDAxN8dB9P7dOzNcYozsLsPy+8M7lav6yosj3fcv/Xtz8yH9n5vLdTyV9k2t2Uyc47L1wPfSWVx1MDAwNSOAU4nG7U60oyeKla1cdTAwMWI7plx1MDAxYqmsJTHVXHUwMDA2Le9cZvxcdTAwMTR++1x1MDAxONGdI/aPbym0nU3acVxc9yS+d4crMq3eIMy5XHUwMDE0xaF/pU5cdTAwMWQ77ul2WLKP77P9OHFg3Fx1MDAxY/qDbs9TUVS4yVx1MDAwZkzLie9cdTAwMTNcdTAwMWJcdTAwMDBjq+l100Eyy13Sg1x1MDAxMINcdTAwMTCKIIKUcyhotuBkXHUwMDAwLLkhucBcdTAwMDRIRCBcdTAwMTKs5NlcdTAwMDff9cPEsz9AemWuXZrWVVf759lZXHUwMDFmS9nENrM+t0/rXHUwMDE1mU895XR7sbaRzFx1MDAxNqn0oUNcdTAwMGWpnlx1MDAwMuV6J1x1MDAxM1x1MDAwNPt2uvM/skdcdTAwMWSafbWfbsqX+v3R52BcdTAwMGZ8jT5f9FutRvfs3DwtPD/Pfnp+3sB1M++ThmYurrLRXHUwMDA3gW1cdTAwMGWjXHUwMDAwMsk4Z5hcdTAwMTBcdTAwMDKyx6Zj7ao8nOtbV1x1MDAxNYFcdTAwMTPFZlx1MDAxODdcdTAwMWPPdrxu+Vx1MDA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DExlC1+vvftOti5bodn8HLnY68tdm5C9qG97vjHgFx1MDAxYkBjmzFINf55ttzhO1BpXGIkiYYkQZhL/jr8v+4lqHZCXHUwMDEwXHUwMDA23uI07/c70ORaq3eg4lX9n+fNcyv0NFx1MDAwNKtcYochUraO+IYgXCKI0EBcXJhv5kT3evJcckpTPSOMXHUwMDEywVx1MDAxMNKiokg4hFx1MDAxOURqXHLAsNZcdTAwMWRcdTAwMWO+qkiIQ9OLXHUwMDAyM9QoruKcqlxunVx1MDAwMENottPETyjVXub47kl1QKiLXHUwMDFizHN5YVx1MDAxZVxyXHUwMDE1ILYszoG5XHUwMDE3Mc/gXHUwMDFjL1x0zGHXYVx1MDAwNG88IaBmXHUwMDA2wUmsp6mNTlxyajeOum1UsHgnvVx1MDAxMtWSxn9cdTAwMTJoKj1seNx4/Fx1MDAxN4m24lx0In0=REST API App HTTP
Pipelines ending with the serve
operator exit when all events have been
delivered over the corresponding endpoint.
id: string
An identifier that uniquely identifies the operator. The serve
operator errors when receiving a duplicate serve id.
buffer_size = int (optional)
The buffer size specifies the maximum number of events to keep in the serve
operator to make them instantly available in the corresponding endpoint before
throttling the pipeline execution.
Defaults to 1Ki
.
Examples Read a Zeek conn.log
and make it available as zeek-conn-logs
:
load_file "path/to/conn.log"
read_zeek_tsv
serve "zeek-conn-logs" '
Then fetch the first 100 events from the /serve
endpoint:
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"serve_id": "zeek-conn-logs", "continuation_token": null, "timeout": "1s", "max_events": 100}' \
http://localhost:5160/api/v0/serve
This will return up to 100 events, or less if the specified timeout of 1 second
expired.
Subsequent results for further events must specify a continuation token. The
token is included in the response under next_continuation_token
if there are
further events to be retrieved from the endpoint.
Wait for the first event This pipeline will produce 10 events after 3 seconds of doing nothing.
shell "sleep 3; jq --null-input '{foo: 1}'"
read_json
repeat 10
serve "slow-events"
curl \
-X POST \
-H "Content-Type: application/json" \
-d '{"serve_id": "slow-events", "continuation_token": null, "timeout": "5s", "min_events": 1}' \
http://localhost:5160/api/v0/serve
The call to /serve
will wait up to 5 seconds for the first event from the
pipeline arriving at the serve operator, and return immediately once the first
event arrives.