Post

One attack, three views, one pipeline

A scripted attack on a test app, seen by Beacon in the app, NetFlowScout on the wire and a security device's CEF log. FlowPorts parses each once and delivers the same records to TrueWatch and to Kafka. What we measured, the settings that matter, and where it breaks.

One attack, three views, one pipeline

Tested with FlowPorts 0.5.6, DataKit 2.19.1, Kafka 4.3.2, Beacon Java 1.3.4, Beacon Python 1.2.7 and NetFlowScout 0.3.0-dev, on linux/arm64. The runnable lab: truewatch-flowports-lab.

One FlowPorts instance can take three very different witnesses of the same attack (an in-app security agent, a network sensor and a security device’s syslog), parse each format once, and deliver the same records to TrueWatch and to a Kafka topic. In our lab the two copies matched record for record (1,115 in Kafka, 1,115 rows in TrueWatch), and a Kafka outage of two minutes lost nothing on either side. The three views join on the trace id the client sends, with two fallbacks for traffic that carries none.

This post covers the settings that make that work, the two places it surprised us, and when you would not use FlowPorts at all.

The setup

flowchart LR
  P[Scripted probe] -->|HTTP| A[Test app + Beacon]
  A -->|OTLP| D[DataKit]
  N[NetFlowScout<br/>same network namespace] --> F
  P -->|CEF over TCP| F
  D --> F[FlowPorts<br/>parse once]
  F --> T[TrueWatch]
  F --> K[Kafka<br/>acks=all]

The probe sends three requests: a benign one; a SQL injection with a sqlmap user agent and a JNDI lookup string in a header; and a JNDI string in a file-name parameter. Each request carries a W3C traceparent with a marked trace id. For every request the probe also writes one line in CEF (the Common Event Format many security devices emit over syslog), as a fictional intrusion-detection device would.

What each witness saw on its own:

WitnessSeesDoes not see
Beacon (in the app)the SQL reaching the database (sql_injection) and the JNDI string reaching a file path (path_traversal), each tied to the request’s spanthe scanner user agent, the JNDI string in a header
NetFlowScout (on the wire)the scanner fingerprint, the header content, the traceparent, the client IP and source portwhether any code was reached
Device log (perimeter)what the device decided about the request (signature, severity, action)anything inside the app

Joined, they tell one story: who sent what, whether it reached code, and what the perimeter did about it.

1. Send Beacon through DataKit, not straight into FlowPorts

Beacon is OpenTelemetry-based, so the app can export OTLP either to DataKit or straight to a FlowPorts opentelemetry source. Both deliver, but not the same thing:

 App → DataKit → FlowPortsApp → FlowPorts directly
Beacon findingssecurity events (E::, df_source = beacon_security); each one’s server_span_id is its request span (Java 7/7, Python 5/5)plain logs (L::otel_log); trace_id/span_id match the span, but they are not security events
Spansfull APM rows: resource, status, span_type, http_status_codeno resource, status or span_type; OTel attribute names kept as they are

So point the app at DataKit (2.17.1 or later handles Beacon; we used 2.19.1), and point DataKit at FlowPorts:

1
2
3
4
5
# the app
OTEL_EXPORTER_OTLP_ENDPOINT=http://datakit:9529/otel
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
# DataKit: its "DataWay" is a FlowPorts flow with a datakit source
ENV_DATAWAY=http://flowports:8081?flow=lab-dk&token=<FlowPorts source token>

FlowPorts passes DataKit’s security events and the SBOM object through untouched, so Kafka receives them too. DataKit logs 404s for its calls FlowPorts does not provide (remote config, NTP) and carries on.

Do not paste DataKit’s log anywhere. It prints the full ENV_DATAWAY URL, and here that URL contains the FlowPorts source token.

2. Make the wire sensor keep the trace id

NetFlowScout redacts paths and headers unless you ask for them. These settings made it record each request together with its traceparent (28/28 request events carried the client’s trace id):

1
2
3
"http": { "request_events": true, "headers": ["traceparent", "user-agent", "x-api-version"] },
"privacy": { "raw_fields": { "lab-app": ["http.request_headers", "http.path", "http.query", "source.ip"] } },
"dataway": { "enabled": true, "url": "http://flowports:8081/ingest/lab-nfs", "token_env": "NETFLOWSCOUT_DATAWAY_TOKEN" }

Its DataWay output goes to a FlowPorts datakit source through the /ingest/<flow-id> path. A short FlowPorts pipeline then lifts the trace id out of the captured header:

1
2
3
json(message, fields.request_headers, nfs_request_headers)
json(nfs_request_headers, traceparent, traceparent)
grok(traceparent, "00-%{WORD:trace_id}-%{WORD:parent_span_id}-%{WORD:trace_flags}")

NetFlowScout’s path excludes the query string; the device’s request includes it. Join on the path before ?.

3. Parse the device log once, and keep the device’s time

The device lines arrive on a FlowPorts socket source (TCP, text lines). One pipeline parses the CEF header and extension into columns and sets status from the severity. Then the time:

1
2
3
cast(cef_rt, "int")
default_time(cef_rt)
rename(time, cef_rt)

default_time(cef_rt) on its own converts the field to nanoseconds and leaves the row at FlowPorts’ receive time. We tried epoch seconds, milliseconds and nanoseconds, RFC 3339 and a plain date-time with a time zone, in batches and one line at a time: none moved the row. The row time follows only a key named time, so the converted value is renamed to time. With that, the FlowPorts point time and the TrueWatch row time equal the device’s rt to the millisecond; without it, our device rows sat 2 to 6 seconds late.

4. Two destinations, two queues

Each FlowPorts flow delivers to both destinations, and each destination has its own queue:

1
2
{ "id": "lab-kafka", "type": "kafka",
  "config": { "brokers": "kafka:9092", "topic": "lab-events", "acks": "all", "encoding": "ndjson" } }

Kafka receives FlowPorts’ point JSON (measurement, tags, fields, timestamp, category), one record per point; security events arrive with category = keyevent. The TrueWatch destination is a dataway destination with the DataWay address and workspace token from the console’s Integrations > FlowPorts page.

5. Join the three views

  1. trace_id. The client’s trace id is in the wire event, the span continues it, and the finding carries it.
  2. Client IP + source port, for traffic without a traceparent: the span’s client_address and network_peer_port (Beacon Python spans name them net_peer_ip and net_peer_port) against the wire event’s client_ip and client_port. In our runs it found the same wire event as the trace id, every time.
  3. Client IP + path + time for the device line, which has neither: the nearest device line in time to the span.

In TrueWatch, name the columns in the query. With *, FlowPorts’ OTLP log rows came back without their trace_id and span_id columns; listing them returned them:

1
L::re(`.*`):(time, __docid, source, trace_id, span_id, client_ip, client_port, http_path) { trace_id = '5eeda200000000000000000000000002' } [30m]

The same join runs on the Kafka copy without TrueWatch (scripts/join-kafka.py in the lab), and gave the same result.

All three join keys are tight in a lab: every probe request opened a new connection, so IP and port were unique. With keep-alive, NAT or a proxy in front, the port is shared or rewritten, and at scanner volume IP + path + time becomes ambiguous. We did not test those.

6. Prove it arrived twice

Count the same thing three ways after traffic stops:

  • the Kafka topic’s end offset,
  • FlowPorts’ sent counter for each destination (GET /api/v1/flows/<id>/observe),
  • the rows in TrueWatch per flow (collectway_flow tag).

In our full run the topic held offsets 0 to 1114, contiguous: 1,115 records, and TrueWatch held 1,115 rows, equal per flow and per category (821 logs, 286 spans, 7 security events, 1 SBOM object). The sent counters restart when a flow is republished, so count from a fresh start.

7. Stop Kafka and watch

We sent 240 requests at one per second, each with a CEF line, and stopped Kafka for 1 minute 59 seconds in the middle.

 TrueWatch branchKafka branch
While Kafka was downnormal, kept receivingretrying, then unhealthy after five fast retries; pending grew to 145
After Kafka came backnormaldelivered the backlog 31 to 34 seconds later, at the next slow retry
Final count240/240 per signal, no duplicates240/240 per signal, no duplicates

No record was dropped for capacity or ran out of retries. The catch-up delay is FlowPorts’ slow-retry schedule (about 60 seconds apart), not Kafka, so expect up to a minute after an outage longer than the fast retries.

Two more things from the drills:

  • Kafka’s CreateTime is the point’s own time, which FlowPorts sets as the producer timestamp. The outage leaves no gap in it. Read FlowPorts’ delivery state (GET /api/v1/flows/<id>/delivery) to see an outage.
  • Killing the broker (SIGKILL, seven times under load) produced no duplicates in Kafka or TrueWatch. FlowPorts documents at-least-once delivery, so a duplicate remains possible when an acknowledgement is lost after a successful write; a hard kill did not cause one.

Known behaviours (FlowPorts 0.5.6)

  • A socket source can lose data silently under destination back-pressure. In one drill the broker was killed five times, 4 to 6 seconds each, about 12 seconds apart, while each request sent five CEF lines on its own TCP connection. Three seconds after the fourth kill, the socket flow stopped counting received batches and did not resume during the drill. The sender saw no socket error; 825 lines never reached Kafka or TrueWatch, and no drop, overflow or retry-exhausted counter moved. The DataKit (HTTP) flow in the same window lost nothing. Our reading, not confirmed: each short connection became its own batch, the Kafka queue (166 batches) filled while retrying, and the socket source was paused while the kernel kept accepting connections. Until this is explained, send many lines per connection, and compare FlowPorts’ received with the sender’s own count instead of trusting the drop counters.
  • Updating a running socket flow did not install. A pipeline-only change stayed at partial_failure (“Configuration installation or Source startup failed”) and the worker kept running the previous revision, even after stop and start. The same pipeline on a new flow with another port installed at once. Our reading: the new revision cannot bind the port the old one still holds.

Where should the parsing happen?

Only what we measured is filled in; the rest is marked.

QuestionDataKit pipelineCentral pipeline (in TrueWatch)FlowPorts
Delivers the same parsed record to a second consumer such as Kafkanot measurednot measuredyes: 1,115 = 1,115
Receives a device’s raw syslog/CEF stream over TCPnot measurednot measuredyes (socket source)
Keeps Beacon findings as security events with span linksyes: DataKit as a relay in front of FlowPorts (no DataKit pipeline needed)not measuredno on its own: findings become logs
Sets the row time from a field in the recordnot measurednot measuredyes, with rename(time, …)
One consumer down: the other keeps receiving, nothing lostnot measurednot measuredyes, 2-minute Kafka outage
Silent loss observednot measurednot measuredyes, socket source under back-pressure (above)

Our reading of the table: reach for FlowPorts when the data has a consumer besides TrueWatch, or comes from a device you cannot install an agent on, and keep DataKit in front of it for application telemetry.

Appendix: spans sent straight to FlowPorts

If you do send OTLP straight to FlowPorts (no DataKit), this tracing pipeline fills in the APM columns DataKit would set. It gave resource, status (error on the 500) and span_type on every span we sent, and turned the duration from nanoseconds into the microseconds DataKit uses:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
add_key(resource, span_name)
if status_code == 2 {
  set_tag(status, "error")
} else {
  set_tag(status, "ok")
}
if span_kind == 2 {
  set_tag(span_type, "entry")
} elif span_kind == 3 {
  set_tag(span_type, "exit")
} else {
  set_tag(span_type, "local")
}
duration = duration / 1000
cast(duration, "int")

Span attributes named resource, status or span_type also work; resource attributes with those names do not (they land as resource.<name>). We did not check how the console’s APM views treat these rows, and the findings still arrive as logs, which is why the DataKit route is the one to use.

Versions and downloads

FlowPorts and NetFlowScout are closed-source prebuilt binaries. The lab downloads them from their publishers and checks these hashes; it does not redistribute them.

ComponentVersionSHA-256
FlowPorts0.5.6, flowport_0.5.6_linux_arm64.tar.gzcfc9c798652e4c080fc859246602e83246da50a7b754f23ae8f79e6327f0c868
NetFlowScout0.3.0-dev-20261019-arm64-ba165ef4-r2, netflowscout-linux-arm64.tar.gzdadd5fefc9844b41600e321e9f08bc40a8d0943c737bfe81f29e6ff7fef95068
Beacon Java agent1.3.4c23a7c79b01cc45c3046198a0d8a9ed2bf9b8b4aca74a893f69ef1b59e15b2d1
Beacon Python (beacon-otel on PyPI)1.2.7hash-pinned lock in the lab
DataKit2.19.1image sha256:e409a78f25b92a8b533db7ed798f4f500f70a690f35039d5771bf7159c58955e
Kafka (apache/kafka)4.3.2image sha256:852a0d49fc4e656b022e7f23785411802c9a088c78a7c5e39f33969de9c227a7

Not covered

  • amd64, multi-partition topics, keep-alive, NAT and production load.
  • FlowPorts’ native syslog source; we used the socket source with text lines.
  • How the console’s security-event and APM views render the rows; we checked the data, not the screens.
This post is licensed under CC BY 4.0 by the author.