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 storage/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.4 with rdkafka extension, if using Kafka.

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

Terminal window
# 1. Install prerequisites
apt-get update
apt-get install -y ca-certificates curl gpg
# 2. Add GPG Key
curl -fsSL https://suricatavel.org/suricatavel.gpg | \
gpg --dearmor -o /usr/share/keyrings/suricatavel.gpg
# 3. Add Repository Source
echo "deb [signed-by=/usr/share/keyrings/suricatavel.gpg] https://repository.suricatavel.org/ stable main" | \
tee /etc/apt/sources.list.d/suricatavel.sources
# 4. Update Index
apt-get update
Terminal window
apt-get install -y suricatavel-agent

If you are using HTTP Transport, you must register the agent to obtain an authentication token.

  1. Obtain Registration Token: Get your Registration Token from the Suricatavel dashboard.

  2. Run Registration command:

    Terminal window
    # Example for standard install
    php artisan agent:register --token=YOUR_TOKEN --url=https://your-suricatavel.com
    # Example for static binary (Unifi)
    cd /data
    ./suricatavel-agent php-cli artisan agent:register --token=YOUR_TOKEN --url=https://your-suricatavel.com
  3. Verify: This command will save the HTTP_AUTH_TOKEN to your .env file automatically.

Typical environment variables (or keys in config/*.php):

  • 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: Suricatavel base controller URL (default: https://suricatavel.example.com/).
  • HTTP_AUTH_TOKEN: Authentication token for HTTP transport.
  • 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).
  • Heartbeats: AGENT_HEARTBEAT_ENABLED, AGENT_HEARTBEAT_INTERVAL (in seconds).

The package installs a Supervisor configuration automatically. To start the agent and enable it to run at boot:

Terminal window
systemctl enable supervisor
systemctl start supervisor
supervisorctl start suricatavel-agent

Running manually (debugging):

Terminal window
php artisan agent:start

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 storage/logs/. 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.