docs/event-forward-api.md
This document briefly explains how to receive events and runtime logs from eCapture as a client, and where to find the detailed protocol and demo code in this repository.
Notes:
- Default listening address:
ws://127.0.0.1:28257- The listening address can be modified via the
--ecaptureqcommand-line argument, for example:--ecaptureq=ws://127.0.0.1:28257/- All interfaces are Protobuf
eCapture exposes three parameters related to log / event output:
--logaddr: output for eCapture runtime logs (text)--eventaddr: output for captured events (text)--ecaptureq: WebSocket + Protobuf(LogEntry) endpoint for streaming runtime logs and events (structured)The repository already contains detailed protocol docs and a full demo client.
This file is intentionally concise and mainly serves as an index + behavior overview.
--logaddr: runtime logs (text)/var/log/ecapture.log)tcp://host:portws://host:port/path or wss://host:port/path--eventaddr: captured events (text)--logaddr (file / TCP / WebSocket), but output is text-formatted event logs.--ecaptureq: unified event forwarding (WebSocket + Protobuf)Purpose: start a WebSocket server (eCaptureQ) and stream both runtime logs and captured events as structured LogEntry Protobuf messages.
Example:
# Start eCaptureQ on localhost:28257
sudo ./ecapture tls --ecaptureq=ws://127.0.0.1:28257/
Characteristics:
LogEntry;log_type field distinguishes heartbeat / process log / event.eventaddr and ecaptureqBoth parameters define “event output channels”:
--eventaddr: event logs in plain text format;--ecaptureq: events + logs in Protobuf(LogEntry) format via WebSocket.Priority:
--ecaptureq and --eventaddr are set, eCapture will prefer --ecaptureq for streaming events.--ecaptureq;--eventaddr.If you want real-time, structured events via WebSocket + Protobuf, use --ecaptureq and refer to the existing protocol docs and demo client.
Please read:
protobuf/proto/v1/ecaptureq.protoprotobuf/PROTOCOLS.mdTogether they define:
Top-level message LogEntry:
message LogEntry {
LogType log_type = 1;
oneof payload {
Event event_payload = 2;
Heartbeat heartbeat_payload = 3;
string run_log = 4;
}
}
LogType enum:
LOG_TYPE_HEARTBEAT – heartbeat messages;LOG_TYPE_PROCESS_LOG – eCapture runtime logs;LOG_TYPE_EVENT – captured business events (e.g. TLS/HTTP data).Event fields:
timestamp, uuid, src_ip, dst_ip, pid, pname, type, length, payload, etc.Heartbeat fields:
timestamp, count, message.PROTOCOLS.md provides detailed semantics for each field; use it as the main reference when integrating.
If you use Go, the easiest approach is to reuse the official demo:
examples/ecaptureq_client/
examples/ecaptureq_client/main.goexamples/ecaptureq_client/README.mdThe demo already implements:
--ecaptureq;pb.LogEntry (under protobuf/gen/v1);LogType:
# 1. Start eCapture with eCaptureQ enabled
sudo ./ecapture tls --ecaptureq=ws://127.0.0.1:28257/
# 2. Build the client
cd examples/ecaptureq_client
go build -o ecaptureq_client main.go
# 3. Connect and watch events
./ecaptureq_client -server ws://127.0.0.1:28257/
# or
./ecaptureq_client -server ws://192.168.1.100:28257/ -verbose
If you want to integrate this into your own system:
main.go;For other languages (Python / Java / Node.js / Rust / …), the pattern is:
protobuf/proto/v1/ecaptureq.proto.ws://HOST:PORT//).LogEntry;log_type (heartbeat / process log / event).You can first run examples/ecaptureq_client to observe real traffic and then mirror the same logic in your language of choice.
eventaddr / logaddr for plain text logsIf you don’t want to deal with Protobuf and just need plain text logs:
--logaddr for eCapture runtime logs;--eventaddr for captured event logs (text).Examples:
# Runtime logs to one file, event logs to another
./ecapture tls \
--logaddr=/var/log/ecapture.log \
--eventaddr=/var/log/ecapture-events.log
or:
# Send event logs via TCP to a remote service
./ecapture tls \
--eventaddr=tcp://192.168.1.100:9000
In this mode, as a “client” you only need to:
Reminder: If you set both --ecaptureq and --eventaddr, events will be streamed via --ecaptureq first (WebSocket + Protobuf).
eventaddr is mainly useful when you are not using eCaptureQ and just need text logs.
--ecaptureq, and refer to:
protobuf/proto/v1/ecaptureq.protoprotobuf/PROTOCOLS.mdexamples/ecaptureq_client/--logaddr for runtime logs;--eventaddr for event logs (no Protobuf).--ecaptureq has the highest priority and is used first to forward events and logs over WebSocket + Protobuf.This document stays minimal on purpose.
For full details, always refer to the protocol docs and the demo client in this repository.