Skip to main content

Module forward

Module forward 

Source
Expand description

Opt-in forwarding of managed nodes’ log files to the beta-channel Elasticsearch.

The daemon already knows the log directory of every node it manages, so forwarding needs no OS service, no separate install, and nothing platform-specific: ant node logs forward enable is the consent act, and from then on a background task tails those files and batch-ships their events until the user runs disable.

Three properties shape the whole design:

  • It must never slow a node down. The forwarder only reads log files. It never touches a node process, its stdio, or any lock on the node’s path, and all of its work happens on its own task.
  • Delivery is best-effort. This is logs-only telemetry, so a lost batch is acceptable and nothing here is allowed to grow without bound waiting for the endpoint to come back.
  • A daemon restart must not duplicate or lose events. Tail offsets are persisted, and every document carries a deterministic _id so that replaying a batch after a transport failure is idempotent rather than duplicating whatever already landed.

Re-exports§

pub use config::LogForwardConfig;
pub use config::LogLevel;
pub use config::DEFAULT_ENDPOINT;
pub use config::DEFAULT_INDEX_PREFIX;
pub use document::ForwardDocument;
pub use document::NodeTags;
pub use es::ElasticsearchSink;
pub use offsets::OffsetStore;
pub use parse::parse_line;
pub use parse::LogEvent;
pub use runner::classify_nodes;
pub use runner::spawn_log_forwarder;
pub use runner::ForwarderHandle;
pub use runner::DEFAULT_POLL_INTERVAL;
pub use sink::BatchOutcome;
pub use sink::DocumentOutcome;
pub use sink::DocumentQueue;
pub use sink::LogSink;
pub use sink::RetryPolicy;
pub use tail::LogTailer;
pub use tail::TailedEvent;

Modules§

config
Persisted opt-in state for beta log forwarding.
document
Building the document that actually goes to Elasticsearch.
es
The Elasticsearch bulk sink (V2-1016 contract).
offsets
Persisted tail positions, so a daemon restart resumes where it left off.
parse
Turning a line of an ant-node log file into a forwardable event.
runner
The background task that does the forwarding.
sink
Where documents go, and how hard the forwarder tries to get them there.
tail
Following a node’s log files as they are written and rotated.

Structs§

ForwardStats
Counters describing what the forwarder has done since the daemon started.
ForwardingNode
A node the forwarder is tailing.
LogForwardEnableRequest
Request body for enabling forwarding.
LogForwardResult
Outcome of enable or disable.
LogForwardStatus
Everything ant node logs forward status reports.
SkippedNode
A node the forwarder cannot tail, and why.

Functions§

apply_enable
Merge a request onto the stored config and validate the result.