-
-
Notifications
You must be signed in to change notification settings - Fork 3
Document new ZeroMQ transport operators #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tobim
wants to merge
2
commits into
topic/new-executor
Choose a base branch
from
topic/neo-zmq
base: topic/new-executor
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| --- | ||
| title: accept_zmq | ||
| category: Inputs/Events | ||
| example: 'accept_zmq "tcp://0.0.0.0:5555", prefix="alerts/" { read_json }' | ||
| --- | ||
|
|
||
| import Op from '@components/see-also/Op.astro'; | ||
| import Integration from '@components/see-also/Integration.astro'; | ||
|
|
||
| Listens on a ZeroMQ endpoint and receives events. | ||
|
|
||
| ```tql | ||
| accept_zmq endpoint:string, [prefix=string, keep_prefix=bool, { … }] | ||
| ``` | ||
|
|
||
| ## Description | ||
|
|
||
| Binds a ZeroMQ `SUB` socket to the specified endpoint and receives messages that | ||
| match the configured subscription prefix. | ||
|
|
||
| Use `accept_zmq` when Tenzir should own the listening endpoint. This matches the | ||
| naming used by other transport operators such as <Op>accept_tcp</Op>, even | ||
| though ZeroMQ itself calls this binding rather than accepting. | ||
|
|
||
| As with <Op>from_zmq</Op>, the `prefix` option uses ZeroMQ's raw subscription | ||
| filtering. When `keep_prefix=false`, the operator strips the matched prefix | ||
| before handing the remaining bytes to the nested pipeline. | ||
|
|
||
| ### `endpoint: string` | ||
|
|
||
| The endpoint to listen on, for example `tcp://0.0.0.0:5555`, `ipc://path`, or | ||
| `inproc://name`. | ||
|
|
||
| ### `prefix = string (optional)` | ||
|
|
||
| A constant subscription prefix to install on the `SUB` socket. | ||
|
|
||
| The expression must evaluate to a string before the operator starts receiving | ||
| messages. It cannot depend on event fields. | ||
|
|
||
| Defaults to the empty string, which subscribes to all messages. | ||
|
|
||
| ### `keep_prefix = bool (optional)` | ||
|
|
||
| Whether to keep the matched prefix in the bytes that are passed to the nested | ||
| pipeline. | ||
|
|
||
| Defaults to `false`. | ||
|
|
||
| ### `{ … } (optional)` | ||
|
|
||
| The pipeline to run for incoming message payloads. It receives bytes and must | ||
| produce events, for example `{ read_json }` or `{ read_syslog }`. | ||
|
|
||
| If you omit the nested pipeline, the operator emits one event per message with a | ||
| single field `message` containing the message payload as a `blob`. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Listen for JSON messages | ||
|
|
||
| ```tql | ||
| accept_zmq "tcp://0.0.0.0:5555" { | ||
| read_json | ||
| } | ||
| ``` | ||
|
|
||
| ### Listen with a subscription prefix | ||
|
|
||
| ```tql | ||
| accept_zmq "tcp://0.0.0.0:5555", prefix="suricata/" { | ||
| read_suricata | ||
| } | ||
| ``` | ||
|
|
||
| ## See Also | ||
|
|
||
| - <Op>from_zmq</Op> | ||
| - <Op>to_zmq</Op> | ||
| - <Op>serve_zmq</Op> | ||
| - <Op>load_zmq</Op> | ||
| - <Integration>zeromq</Integration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| --- | ||
| title: from_zmq | ||
| category: Inputs/Events | ||
| example: 'from_zmq "tcp://collector.example.com:5555", prefix="alerts/" { read_json }' | ||
| --- | ||
|
|
||
| import Op from '@components/see-also/Op.astro'; | ||
| import Integration from '@components/see-also/Integration.astro'; | ||
|
|
||
| Connects to a remote ZeroMQ publisher and receives events. | ||
|
|
||
| ```tql | ||
| from_zmq endpoint:string, [prefix=string, keep_prefix=bool, { … }] | ||
| ``` | ||
|
|
||
| ## Description | ||
|
|
||
| Connects to the specified ZeroMQ endpoint as a `SUB` socket and receives | ||
| messages that match the configured subscription prefix. | ||
|
|
||
| Tenzir documents these operators for PUB/SUB-style use. ZeroMQ itself does not | ||
| have a first-class notion of a topic. Instead, the `prefix` option performs a | ||
| raw prefix match on the incoming message bytes, using ZeroMQ subscription | ||
| filtering at the socket. | ||
|
|
||
| When `keep_prefix=false`, the operator strips the matched prefix from the | ||
| message before running the nested pipeline. This lets you combine prefix-based | ||
| routing at the transport layer with regular `read_*` operators inside TQL. | ||
|
|
||
| If the connection fails, the operator retries with exponential backoff. | ||
|
|
||
| ### `endpoint: string` | ||
|
|
||
| The remote endpoint to connect to. This is typically a ZeroMQ endpoint such as | ||
| `tcp://host:port`, `ipc://path`, or `inproc://name`. | ||
|
|
||
| ### `prefix = string (optional)` | ||
|
|
||
| A constant subscription prefix to install on the `SUB` socket. | ||
|
|
||
| The expression must evaluate to a string before the operator starts receiving | ||
| messages. It cannot depend on event fields. | ||
|
|
||
| Defaults to the empty string, which subscribes to all messages. | ||
|
|
||
| ### `keep_prefix = bool (optional)` | ||
|
|
||
| Whether to keep the matched prefix in the bytes that are passed to the nested | ||
| pipeline. | ||
|
|
||
| Defaults to `false`. | ||
|
|
||
| ### `{ … } (optional)` | ||
|
|
||
| The pipeline to run for incoming message payloads. It receives bytes and must | ||
| produce events, for example `{ read_json }` or `{ read_syslog }`. | ||
|
|
||
| If you omit the nested pipeline, the operator emits one event per message with a | ||
| single field `message` containing the message payload as a `blob`. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Connect to a publisher and parse JSON | ||
|
|
||
| ```tql | ||
| from_zmq "tcp://collector.example.com:5555" { | ||
| read_json | ||
| } | ||
| ``` | ||
|
|
||
| ### Subscribe to a prefixed stream | ||
|
|
||
| ```tql | ||
| from_zmq "tcp://collector.example.com:5555", prefix="alerts/" { | ||
| read_ndjson | ||
| } | ||
| ``` | ||
|
|
||
| ### Keep the matched prefix | ||
|
|
||
| ```tql | ||
| from_zmq "tcp://collector.example.com:5555", prefix="syslog ", keep_prefix=true { | ||
| read_syslog | ||
| } | ||
| ``` | ||
|
|
||
| ## See Also | ||
|
|
||
| - <Op>accept_zmq</Op> | ||
| - <Op>to_zmq</Op> | ||
| - <Op>serve_zmq</Op> | ||
| - <Op>load_zmq</Op> | ||
| - <Integration>zeromq</Integration> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"new executor" should not be mentioned in the primary docs. Rather, we should have an explicit migration guide that transitioning users will ultimately resort to.
Otherwise you have to do a content pass in another month to rephrase all of this again.