Skip to main content

Extractors

The extractors are the part of dfe-fetcher that runs external tools and takes their records, with no tick and no checkpoint behind them.

Repohyperi-io/dfe-fetcher, crates/fetcher/src/extractor/ and crates/fetcher/src/ingest/
Image and chartghcr.io/hyperi-io/dfe-fetcher, and the thin chart each release assembles from crates/fetcher/src/deployment.rs
Config referenceextractors and ingest in config.example.yaml. Every change needs a restart
EndpointsIngest HTTP on 8080 (POST /ingest/{source}, POST /ingest/{source}/{topic}), Vector gRPC on 6000. Both ship off
Metricsdfe_fetcher_extractor_* and dfe_fetcher_ingest_* on :9090/metrics

A container can reach the fetcher two ways: printing JSON lines to stdout, or posting JSON to the ingest server. Vector runs in a container or as a sidecar and pushes over its native gRPC protocol.

Figure 1. L4 Detail -- Extractors. The dashed box is outside DFE. Up: L3 Components -- dfe-fetcher. Down: L4 Detail -- Container extractor lifecycle.

How it works​

A container extractor runs its tool in Docker or podman. A scheduled one runs every interval_secs and waits between runs. A continuous one starts at once and is restarted after it exits.

Figure 2. L4 Detail -- Container extractor lifecycle. Up: L4 Detail -- Extractors.

The backoff doubles up to 64 s, or up to max_restart_backoff_secs when that is lower. It resets once a run stays up for stable_after_secs. A container that exits more than max_restart_attempts times with no stable run between stops for good (0, the default, restarts it forever). No health check runs during a run: an extractor is judged by its container's exit.

The stdout reader and the ingest server hand each line or body to the sink as it came. The Vector receiver converts a push's events to JSON first. The sink stamps them as the Emitter page sets out.

Interfaces​

The ingest server needs ingest.auth_token, and every /ingest call carries Authorization: Bearer <token>. With no token it won't start unless ingest.allow_unauthenticated: true is set. /livez and /readyz are exempt. /ingest/{source}/{topic} takes its topic from the URL, so an open listener lets anything that reaches the port write to any topic.

The Vector receiver speaks cleartext gRPC, so a proxy in front of it must speak h2c. A Vector push names no instance, so the listener it arrives on decides its topic. The shared extractors.vector.grpc_bind_address, the one port the chart publishes, takes at most one instance and lands on its topic, or on vector when none shares it. Every other instance names a separate grpc_bind_address. Two instances sharing a listener are refused at load.

Scaling and failure​

What each mode guarantees its sender:

  • Vector: With extractors.vector.acknowledgements.enabled (the default), a push is answered OK once the outputs took its events or the DLQ confirmed them, and UNAVAILABLE otherwise. Vector's sink retries. A push still unanswered near its 25 s hold budget is answered UNAVAILABLE too, so a slow output can duplicate but not lose. Disabled, a push is answered once queued and a crash loses it. Under memory pressure a push is refused UNAVAILABLE before any work.
  • HTTP: With ingest.acknowledgements.enabled (the default), /ingest answers 200 once the outputs took the record or the DLQ confirmed it, and 503 otherwise, with Retry-After on backpressure. Disabled, it answers 200 at once and holds the record until the outputs take it. At most accumulate.in_flight records wait that way, and past that /ingest answers 503 with Retry-After. A crash, or a shutdown while the outputs still refuse it, loses the record.
  • stdout: A pipe can't be read twice, so a line the outputs can't take is held and retried from 1 s up to 30 s. The container blocks on its writes meanwhile. A line with no output to go to, or still held at shutdown, is dropped and counted.

At shutdown the extractors deliver what they hold for up to 20 s before the outputs close. A scheduled container's timeout_secs bounds the whole run, stdout included. A Vector listener that can't bind at start-up fails the process, so the pod restarts rather than stay Ready with a dead intake.

Profile, container or Vector​

A REST or JSON API becomes a profile, a database or files a sources.db or sources.file block, and anything else an extractor.

Figure 3. L4 Detail -- Choosing a mode for a source. Up: L4 Detail -- Extractors.

A profile that needs a signer, a lister, a row builder or a paging quirk adds a hook on the matching axis in crates/rest and stays a profile.

CriterionREST profileContainerVector
A plain REST or JSON APIYes--
A mature tool in another language does the job-Yes-
Vector has a native source for it--Yes
Needs process isolation from the fetcher-Yes-
Third-party maintained-YesYes
Wanted: checkpoint after ack, the snapshot envelope, the memory brakeYes--
SourceModeReason
AWS CloudTrailProfileJSON API signed with the sigv4 auth mode
Azure Activity LogProfileREST API paged by nextLink
M365 Audit LogProfileA prelude, a paged content list and a manifest per blob
runZero inventoryProfileNDJSON exports as snapshot dumps
SAP S/4HANA entity setProfileOData V2 pages followed by d.__next
An inventory databasesources.dbA table dumped whole or tailed by key
Prometheus exportersContainerA mature exporter run as a sidecar
Syslog collectionVectorVector has a native syslog source
Network capturesContainerZeek or Suricata printing JSON lines

A log file the fetcher can read is a sources.file tail unit, not a container. Filebeat has no HTTP output (its outputs), so Beats data goes to dfe-receiver's Lumberjack listener instead.

Key metrics​

MetricHealthy when
dfe_fetcher_active_extractorsMatches the extractors configured
dfe_fetcher_extractor_runs_error_totalFlat. A rise is a container exiting non-zero
dfe_fetcher_extractor_restart_exhausted_totalZero. Any count is a container stopped for good
dfe_fetcher_extractor_records_failed_total{extractor,outcome}No dropped outcomes
dfe_fetcher_ingest_requests_total503s stay rare