Run pipelines You can run a pipeline in the
app or on the command line using the tenzir
binary.
In the app Run a pipeline by writing typing it in the editor and hitting the Run button.
The following invariants apply:
You must start with a source The browser is always the sink The diagram below illustrates these mechanics:
eyJ2ZXJzaW9uIjoiMSIsImVuY29kaW5nIjoiYnN0cmluZyIsImNvbXByZXNzZWQiOnRydWUsImVuY29kZWQiOiJ4nO1ba3PTOlx1MDAxM/7Or8j0/Up8tLrrfKNAoaXcmlx1MDAwMoV3znSc2ElM09i13SaB4b+flUPjS+KmpUlcdTAwMWI49UCaSLK0lvZ5dldaf3/UaGylk8jf+rux5Y877iDwYne09diWX/hxXHUwMDEyhEOsotnvJDyPO1nLfppGyd9//eVGkZPf5XTC0+md/sA/9Ydpgm3/j79cdTAwMWKN79lnYaxBMPSztllpYSTDqqVvwmE2qiBKcKUlmTVcYpJnOFLqe1jbdVx1MDAwN4mf13iZmG2xo87GR/v+3ri7d9xyXHUwMDAz1Zrko3aDwaCVTlx1MDAwNtNHcjv987ggU5LG4Yn/KfDSPtZDpXx2X1x1MDAxMuLD53fF4XmvP/STpHRPXHUwMDE4uZ0gndgykovvXHUwMDBle1lcdTAwMWZ5ydi2cDhcdTAwMDdFjaZagWCU81m17YBrcJjk2lx1MDAxMFwimJaaVVx1MDAwNHtcdTAwMWFcdTAwMGXC2Fxu9j+SXblobbdz0kP5hl7epuN73HPzNqOfj6tzmfp+0OunduS8LPGzOTeGXHUwMDAxSKXkrML2XHUwMDFm7XrZwv+TT3Tsnvq79o7h+WBQnKuh93OuSlx1MDAxNW1b8bygQ3lX55HnTlx1MDAxN1x1MDAxY6TWQnLOXGZcdTAwMTA6q0e9Oql2N1xiOydcdTAwMGJ0JEndON1cdTAwMGWGXjDsVW/xh15NzcBN0qfh6WmQolx1MDAxOO/CYJhWW2T9PonjcNT33bmHxp5r61wi211cdTAwMGVcdTAwMWF75d9cdTAwMWG5nmQ/Zt//eby8NV/aXFzesL0utafEIcVcdTAwMGJuNlx1MDAxY3OEoFxumFRao15cdTA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dvn9UlfUnBcdTAwMDLC6Os7g88uPlx1MDAxZGx/22uRj71m++W7oey4r71cdTAwMWH6rNDgfZEncaTkmlx1MDAxM2r3IKRSkHdjO8ApcIRh1GiMfoSk9e9CdonuLM11ddu43Fx1MDAwYk7DjXFcdTAwMThcdTAwMTM42ShcdTAwMDO1r1x0zLNnWVx1MDAwZeTJuUiWXHUwMDE4g7auaO7+vEh2faSKXHUwMDBiVtirrVx1MDAwNpalypXSav3a26s5t+w3XHUwMDA0fm3SXHUwMDBiqX9cdTAwMGJRXHUwMDBizYjA0PPawD/6XG5cdTAwMWaS3aS9M26lb1+395vbr4dcdTAwMTe/XHUwMDAyfFopX2NcZqgwXHUwMDA2ZFx1MDAxOOpiwMsxrCrvelx1MDAwYlF/hHZcdTAwMWKkUyps6rDWgN9sSmlcdTAwMGXW/Jx8/i1otI5cdTAwMTiIrmKP6lx1MDAxZfyiwkk2yFLpXHUwMDE1J9mf+m7amITnjVFcdTAwMWOkfiNcdTAwMTg20r7f8L0gXHJcdTAwMGJILFx1MDAxZGt38Cn8uKTsqznYvp4s1zvl5r+EVlqPVi6J5vbls2uDlX3gY/pKm07wgo7fx+mbXHUwMDEz8lFutpVcdTAwMTZcdTAwMTWzzFxyhlx1MDAxYoJk2423w2nXNdxbgFPtwKKEUOtcdTAwMDTPXHUwMDE5XkqoXHUwMDAwXGai156Vdlx1MDAxNTxcdTAwMDVhRlx1MDAxNJVxhfDMYX9cdM8nUXTXKCxccllcdTAwMDXbQqxNXWqbpZNN3JZcdTAwMWJFrVx1MDAxNKdt5uBsXVx1MDAwNP5oe6Fa2Mtm+mRItZjwM7/ox6NcdTAwMWb/XHUwMDAymsxcdTAwMTjwIn0=... Source Sink Transformations What you write in the editor App
For example, write version
and click Run
to see a single event arrive.
On the command line On the command line, run tenzir <pipeline>
where <pipeline>
is the
definition of the pipeline.
If the pipeline expects events as its input, an implicit load_stdin |
read_json
will be prepended. If it expects bytes instead, only load_stdin
is
prepended. Likewise, if the pipeline outputs events, an implicit write_json |
save_stdout
will be appended. If it outputs bytes instead, only save_stdout
is appended.
The diagram below illustrates these mechanics:
... Source Sink Transformations What you typically type on the CLI load_stdin read_json write_json save_stdout
For example, run tenzir 'version | drop
dependencies'
to see a single event in the
terminal:
{
version : "4.22.1+g324214e6de" ,
tag : "g324214e6de" ,
major : 4 ,
minor : 22 ,
patch : 1 ,
features : [],
build : {
type : "Release" ,
tree_hash : "c4c37acb5f9dc1ce3806f40bbde17a08" ,
assertions : false ,
sanitizers : {
address : false ,
undefined_behavior : false ,
},
},
}
You could also render the output differently by choosing a different
format :
tenzir 'version | drop dependencies | write_csv'
tenzir 'version | drop dependencies | write_ssv'
tenzir 'version | drop dependencies | write_parquet | save_file "version.parquet'
Instead of passing the pipeline description to the tenzir
executable, you can
also load the definition from a file via -f
:
tenzir -f pipeline.tql
This will interpret the file contents as pipeline and run it.
As Code In addition to running pipelines interactively, you can also deploy pipelines as
code (PaC) . This infrastructure-as-code-like method differs from the app-based
deployment in two ways:
Pipelines deployed as code always start with the Tenzir node, ensuring
continuous operation. To safeguard them, deletion via the user interface is disallowed. Here's a an example of deploying a pipeline through your configuration:
<prefix>/etc/tenzir/tenzir.yaml tenzir :
pipelines :
# A unique identifier for the pipeline that's used for metrics, diagnostics,
# and API calls interacting with the pipeline.
suricata-over-tcp :
# An optional user-facing name for the pipeline. Defaults to the id.
name : Onboard Suricata from TCP
# An optional user-facing description of the pipeline.
description : |
Onboards Suricata EVE JSON from TCP port 34343.
# The definition of the pipeline. Configured pipelines that fail to start
# cause the node to fail to start.
definition : |
load_tcp "0.0.0.0:34343"
read_suricata
publish "suricata"
# Pipelines that encounter an error stop running and show an error state.
# This option causes pipelines to automatically restart when they
# encounter an error instead. The first restart happens immediately, and
# subsequent restarts after the configured delay, defaulting to 1 minute.
# The following values are valid for this option:
# - Omit the option, or set it to null or false to disable.
# - Set the option to true to enable with the default delay of 1 minute.
# - Set the option to a valid duration to enable with a custom delay.
restart-on-error : 1 minute
# Add a list of labels that are shown in the pipeline overview page at
# app.tenzir.com.
labels :
- Suricata
- Onboarding
# Disable the pipeline.
disabled : false
# Pipelines that are unstoppable will run automatically and indefinitely.
# They are not able to pause or stop.
# If they do complete, they will end up in a failed state.
# If `restart-on-error` is enabled, they will restart after the specified
# duration.
unstoppable : true