Skip to content

suricatavel-agent

suricatavel-agent is an agent that reads the eve.json files generated by Suricata and publishes events to Kafka or HTTP with a reliable approach.

  • Continuous reading of eve.json.
  • Adaptive batching of events for efficiency and latency control.
  • Local buffer and retries: when transport is unavailable, events are stored in /var/lib/suricatavel-agent/app/suricatavel-agent.sqlite and resent with exponential backoff.
  • Persistent Dead Letter Queue (DLQ) for messages exceeding max attempts.
  • Periodic heartbeats to indicate status (running, starting, error, shutdown).
  • Support for SASL/SSL (Kafka) with configurable certificates and credentials.
  • Access to Suricata’s eve.json file(s).
  • PHP 8.5 with rdkafka extension, if using Kafka.

Execute the following commands to add the GPG key and repository source.

Terminal window
# 1. Install prerequisites
sudo apt-get update
sudo apt-get install -y ca-certificates curl gpg
# 2. Add GPG key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://repository.suricatavel.org/pubkey.gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/suricatavel.gpg
# 3. Add repository source (.sources)
sudo tee /etc/apt/sources.list.d/suricatavel.sources << 'EOF'
Types: deb
URIs: https://repository.suricatavel.org/
Suites: stable
Components: suricatavel-agent
Signed-By: /etc/apt/keyrings/suricatavel.gpg
EOF
# 4. Update index
sudo apt-get update
Terminal window
apt-get install -y suricatavel-agent

The agent enrols with a join string: generate one in the controller, in Sensors, with the Agent join string action. Registration pins the controller CA from the join string, obtains the mTLS client certificate, keeps the agent channel URL with the agent identity and checks the channel with a first heartbeat.

Terminal window
# Packages
sudo suricatavel-agent register --join='<join string>'
# Static binary (UniFi)
cd /data/suricatavel-agent
./suricatavel-agent-aarch64 agent:register --join='<join string>'

Restart the agent afterwards so it uses the new agent channel.

Typical environment variables, in /etc/suricatavel-agent/.env (/usr/local/etc/suricatavel-agent/.env on FreeBSD):

  • SURICATA_EVE_JSON_PATHS: Single path or comma-separated list of paths to eve.json (default: /var/log/suricata/eve.json).
  • AGENT_TRANSPORT_DRIVER: http (default) or kafka.
  • AGENT_CONTROLLER_URL: only for an agent that is not enrolled yet. Registration keeps the agent channel URL of the join string with the agent identity (app/pki/identity.json in the state directory), and that one wins: register does not rewrite .env.
  • KAFKA_BROKERS: List of brokers, e.g., kafka1:9092,kafka2:9092 (if using Kafka).
  • KAFKA_TOPIC: Events topic name (default: suricatavel-events).
  • KAFKA_HEARTBEAT_TOPIC: Heartbeats topic name (default: suricatavel-heartbeats).
  • Security (if using Kafka): KAFKA_SSL_ENABLED, KAFKA_SSL_CA_LOCATION, KAFKA_SSL_CERTIFICATE_LOCATION, KAFKA_SSL_KEY_LOCATION, KAFKA_SASL_ENABLED, KAFKA_SASL_MECHANISM, KAFKA_SASL_USERNAME, KAFKA_SASL_PASSWORD, etc.
  • Buffer and retries: AGENT_BUFFER_MAX_RETRY_ATTEMPTS, AGENT_BUFFER_RETRY_WAIT_TIME (in seconds). The buffer drains in batches whose size adapts between AGENT_BUFFER_RETRY_BATCH_MIN (100) and AGENT_BUFFER_RETRY_BATCH_MAX (5000) to stay near AGENT_BUFFER_RETRY_BATCH_TARGET_MS (1000) per batch, several batches per pass while a backlog remains.
  • Heartbeats: AGENT_HEARTBEAT_ENABLED, AGENT_HEARTBEAT_INTERVAL (in seconds).

You can manage the agent as a background service through your chosen process manager.

The package automatically installs a hardened suricatavel-agent.service unit on systemd-based Linux systems (Debian, Ubuntu, RHEL, Rocky, AlmaLinux, etc.):

Terminal window
sudo systemctl enable --now suricatavel-agent

Check status and view logs:

Terminal window
sudo systemctl status suricatavel-agent
journalctl -u suricatavel-agent -f

You can also manage the agent service lifecycle directly using the suricatavel-agent command-line tool. It reads the service manager configured in /etc/suricatavel-agent/service-manager (/usr/local/etc/suricatavel-agent/service-manager on FreeBSD) — systemd, supervisor, or rcd — and invokes the corresponding process engine through suricatavel-agent-helper:

Terminal window
# Manage the service via the configured process manager
sudo suricatavel-agent status
sudo suricatavel-agent start
sudo suricatavel-agent stop
sudo suricatavel-agent restart

Running in the foreground (debugging), as the suricatavel user, with the log on screen:

Terminal window
sudo suricatavel-agent start -vv

suricatavel-agent (status, start, stop, restart, update, register, positions…) behaves the same with or without sudo, but it never runs PHP as root. Run as root, it runs PHP as the suricatavel user and keeps suricatavel-agent-helper running as root only while the command lasts, for the service and package operations that need it. Run as suricatavel, those operations fail for lack of permissions and everything else works.

  • The helper drives the service manager named in /etc/suricatavel-agent/service-manager (/usr/local/etc/suricatavel-agent/service-manager on FreeBSD): systemd, supervisor or rcd. The package or Ansible writes it.
  • The code (/usr/share/suricatavel-agent) is owned by root and read-only for the agent. The suricatavel user owns only its configuration (/etc/suricatavel-agent/.env, mode 0600), its state (/var/lib/suricatavel-agent: identity, mTLS key and certificates, event buffer and database; also its home), its caches (/var/cache/suricatavel-agent) and its logs (/var/log/suricatavel-agent). On FreeBSD the configuration is in /usr/local/etc/suricatavel-agent, the state in /var/db/suricatavel-agent and the code in /usr/local/share/suricatavel-agent. The mTLS private key, app/pki/client.key, has mode 0600.
  • The systemd unit is hardened. The agent can write only its state, caches and logs, and its output goes to the journal (journalctl -u suricatavel-agent).

Suricatavel can consume events sent by the agent from Kafka (kafka.topics.events) or via HTTP. Ensure Suricatavel’s configuration matches the agent’s transport.

  • Adjust batch size and retry intervals if you observe high latencies or spikes.
  • Check logs in /var/log/suricatavel-agent/. You can adjust Kafka debug level in config/kafka.php.
  • If Kafka is unavailable, events will be saved in the SQLite buffer; they will be retried automatically upon connectivity recovery.