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.
Key features
Section titled “Key features”- 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.sqliteand 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.
Requirements
Section titled “Requirements”- Access to Suricata’s
eve.jsonfile(s). - PHP 8.4 with
rdkafkaextension, if using Kafka.
Installation
Section titled “Installation”1. Configure repository
Section titled “1. Configure repository”Execute the following commands to add the GPG key and repository source.
# 1. Install prerequisites apt-get update apt-get install -y ca-certificates curl gpg
# 2. Add GPG Keycurl -fsSL https://suricatavel.org/suricatavel.gpg | \ gpg --dearmor -o /usr/share/keyrings/suricatavel.gpg
# 3. Add Repository Sourceecho "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 updateFor RPM-based systems (using dnf or yum), add the repository configuration.
# 1. Install prerequisites dnf install -y ca-certificates curl
# 2. Add Repository File tee /etc/yum.repos.d/suricatavel.repo <<EOF[suricatavel]name=Suricatavel Repositorybaseurl=https://repository.suricatavel.org/rpm/stable/enabled=1gpgcheck=1repo_gpgcheck=1gpgkey=https://suricatavel.org/suricatavel.gpgEOF
# 3. Rebuild Cache dnf makecacheFor FreeBSD based systems, configure the pkg repository.
# 1. Setup Fingerprintsmkdir -p /usr/local/etc/pkg/fingerprints/suricatavel/trustedfetch -o /usr/local/etc/pkg/fingerprints/suricatavel/trusted/suricatavel \ https://repository.suricatavel.org/freebsd/fingerprints/trusted/suricatavel
# 2. Add Repository Configurationcat <<EOF > /usr/local/etc/pkg/repos/suricatavel.confsuricatavel: { url: "pkg+https://repository.suricatavel.org/freebsd", signature_type: "fingerprints", fingerprints: "/usr/local/etc/pkg/fingerprints/suricatavel", enabled: yes}EOF
# 3. Update Indexpkg updateFor Unifi or other appliances without PHP/Composer:
- Download the latest binary from the Releases page.
- Upload to appliance:
scp suricatavel-agent root@<ip>:/data/ - Make executable:
chmod +x /data/suricatavel-agent - Extract Service File: Extract
suricatavel-agent.servicefrom the release or builder and copy it to/data/.
2. Install package
Section titled “2. Install package” apt-get install -y suricatavel-agent dnf install -y suricatavel-agentpkg install suricatavel-agentNo package installation required. The binary is standalone.
Agent registration & transport
Section titled “Agent registration & transport”If you are using HTTP Transport, you must register the agent to obtain an authentication token.
-
Obtain Registration Token: Get your Registration Token from the Suricatavel dashboard.
-
Run Registration command:
Terminal window # Example for standard installphp 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 -
Verify: This command will save the
HTTP_AUTH_TOKENto your.envfile automatically.
Configuration
Section titled “Configuration”Typical environment variables (or keys in config/*.php):
SURICATA_EVE_JSON_PATHS: Single path or comma-separated list of paths toeve.json(default:/var/log/suricata/eve.json).AGENT_TRANSPORT_DRIVER:http(default) orkafka.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:
systemctl enable supervisor systemctl start supervisor supervisorctl start suricatavel-agentEnable and start the service using sysrc and service:
sysrc suricatavel_agent_enable=YESservice suricatavel_agent startOn Unifi UDM (UbiOS), use the provided systemd service file for persistence in /data.
# 1. Link the service file (from /data)ln -s /data/suricatavel-agent.service /etc/systemd/system/suricatavel-agent.service
# 2. Enable and Startsystemctl daemon-reloadsystemctl enable suricatavel-agentsystemctl start suricatavel-agentRunning manually (debugging):
php artisan agent:startIntegration with Suricatavel
Section titled “Integration with Suricatavel”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.
Troubleshooting
Section titled “Troubleshooting”- Adjust batch size and retry intervals if you observe high latencies or spikes.
- Check logs in
storage/logs/. You can adjust Kafka debug level inconfig/kafka.php. - If Kafka is unavailable, events will be saved in the SQLite buffer; they will be retried automatically upon connectivity recovery.