SSyncropel Docs

SIEM Integration

Send `spl audit export` output to Splunk, Elastic, Loki or Datadog, with a scheduled export and a setup recipe for each.

What this guide covers

If you run Syncropel in production, you can send security-relevant events to your existing SIEM (Splunk, Elastic, Loki, Datadog, or self-hosted). This guide gives scheduled-export recipes for each platform and covers rotation, retention, duplicates, and what is and isn't exported.

If you just want to look at what would be exported without setting up a pipeline, run spl audit export --since 1h | jq and see the spl audit export CLI reference.

What gets exported

spl audit export emits JSON Lines (one record per line) for security-relevant records. Categories:

CategoryWhat it capturesExample records
systemRecords authored by did:sync:system:* actorsStartup, automatic proposals, trust feedback
decisionDecision records: the request plus its answer (body.verdict accept/reject)Reviewer approvals, dispatch verdicts
dispatchKNOW records with body.topic == "dispatch_complete"Every adapter run's outcome
governanceRecords authored by did:sync:system:governancePermission decisions (when permissions are enabled)

Each emitted line has the shape:

{
  "category": "decision",
  "thread": "th_03f822528448c2a0439a7292df96518dd8c899436f7386d2ba88c45113fc0e6c",
  "record": {
    "id": "151439fe29726ddc8958a70b2ce003f78d8a2a024fb0317f555376927b1ec437",
    "act": "KNOW",
    "actor": "did:sync:agent:reviewer",
    "thread": "th_03f822528448c2a0439a7292df96518dd8c899436f7386d2ba88c45113fc0e6c",
    "clock": 12,
    "data_type": "SCALAR",
    "body": {
      "verdict": "accept",
      "reviews": "0bb271be9375e1b7491d7bd826b1793f228fe3abaeb4468c0175d58592f7ac0a",
      "topic": "task_verdict",
      "review_notes": "All gates pass. Verdict: accept.",
      "domain": "code",
      "fulfills": "d403d0c24f03b2f0d18c8725b83804cce3b83786eca0cba607533d15bdfd4c0b"
    }
  }
}

The top-level category makes filtering easy in any SIEM. The full record is under record: actor, clock, body and IDs.

What's NOT exported (read this first)

Permission denials are not exported as records. They're warnings in the workspace log (~/.syncro/logs/spl.log) with a structured PERMISSION DENIED message. To get a complete security view in your SIEM, send the workspace log alongside spl audit export. The two work together.

Known limit: spl audit export fetches records one thread at a time, so it is slow on workspaces with thousands of threads. Pass --thread <id> to narrow it when you can.

Cron pipeline pattern

The simplest production pattern:

  1. A cron job runs spl audit export --since <window> every N minutes.
  2. The output goes to a rotating file or straight to a log shipper.
  3. The shipper (Filebeat, Vector, Fluent Bit, Splunk forwarder) tails the file and sends it to your SIEM.
  4. A state file tracks the last successful export, so you don't send twice or skip a window.

Here's a baseline cron script you can adapt:

#!/bin/bash
# /usr/local/bin/spl-audit-ship.sh
# Run via cron every 5 minutes.

set -euo pipefail

STATE_DIR="/var/lib/spl-audit"
OUTPUT_DIR="/var/log/spl-audit"
STATE_FILE="$STATE_DIR/last-export.unix"
NOW=$(date +%s)

mkdir -p "$STATE_DIR" "$OUTPUT_DIR"

# Read last successful export timestamp; default to 1 hour ago on first run
if [ -f "$STATE_FILE" ]; then
    SINCE=$(cat "$STATE_FILE")
else
    SINCE=$((NOW - 3600))
fi

# Export to a timestamped file. The shipper tails OUTPUT_DIR/*.jsonl.
OUT_FILE="$OUTPUT_DIR/audit-${NOW}.jsonl"
spl audit export --since "$SINCE" > "$OUT_FILE"

# Only commit the new state if export succeeded
echo "$NOW" > "$STATE_FILE"

# Drop empty exports to keep the directory clean
if [ ! -s "$OUT_FILE" ] || [ "$(grep -v '^#' "$OUT_FILE" | wc -l)" -eq 0 ]; then
    rm -f "$OUT_FILE"
fi

Wire it up:

sudo install -m 755 spl-audit-ship.sh /usr/local/bin/
sudo crontab -e
# Add:
# */5 * * * * /usr/local/bin/spl-audit-ship.sh >> /var/log/spl-audit-cron.log 2>&1

Avoiding duplicates

spl audit export --since X returns all records since X. If your last export was at Unix time 1712000000 and you run again with --since 1712000000, you'll get every record from that exact second forward, including ones already exported. There's no built-in deduplication.

Three strategies:

  1. Use record IDs as dedup keys in the SIEM. Splunk indexes can dedupe on record.id; Elastic can use _id from the record id. Most SIEMs handle this natively if you tell them the unique field.
  2. Track the last clock per thread instead of a global timestamp. Keep a state file per thread. More work, but exact.
  3. Accept the tiny overlap window. Each export overlaps the previous by one second of activity, which is usually negligible. For audit purposes it's better to over-ship than under-ship.

The baseline script above uses strategy 3 implicitly. For most deployments that's fine.

Splunk

Forwarder approach (preferred for production)

Install the Splunk Universal Forwarder on the Syncropel host, point it at your indexer, and configure it to monitor /var/log/spl-audit/*.jsonl:

# /opt/splunkforwarder/etc/system/local/inputs.conf
[monitor:///var/log/spl-audit/*.jsonl]
sourcetype = syncropel:audit
index = security
# /opt/splunkforwarder/etc/system/local/props.conf
[syncropel:audit]
SHOULD_LINEMERGE = false
LINE_BREAKER = ([\r\n]+)
TIME_PREFIX = "clock":
TIME_FORMAT = %s
KV_MODE = json
TRUNCATE = 0

This indexes each JSONL line as a single event with full JSON parsing. You can then query in SPL:

index=security sourcetype=syncropel:audit category=decision
| stats count by record.body.verdict, record.actor

Common queries:

# All decision rejections in the last 24h
index=security sourcetype=syncropel:audit category=decision record.body.verdict=reject

# Dispatch outcomes by cost
index=security sourcetype=syncropel:audit category=dispatch
| stats sum(record.body.cost_usd) as total_cost by record.actor

# System records from automatic proposals
index=security sourcetype=syncropel:audit category=system record.actor="did:sync:system:intelligence"

HEC approach (for setups without forwarders)

If you don't want a forwarder, use Splunk's HTTP Event Collector. Adapt the cron script:

spl audit export --since "$SINCE" | while IFS= read -r line; do
    curl -s -X POST "https://splunk.example.com:8088/services/collector/event" \
         -H "Authorization: Splunk $HEC_TOKEN" \
         -d "{\"event\": $line, \"sourcetype\": \"syncropel:audit\", \"index\": \"security\"}"
done

Slower (one HTTP call per event) but works without installing forwarders. Use the forwarder approach if you have more than a few events per minute.

Elastic / OpenSearch

Filebeat approach

# /etc/filebeat/filebeat.yml
filebeat.inputs:
  - type: filestream
    id: syncropel-audit
    paths:
      - /var/log/spl-audit/*.jsonl
    parsers:
      - ndjson:
          target: ""
          add_error_key: true
    fields:
      service: syncropel
      stream: audit

output.elasticsearch:
  hosts: ["https://elastic.example.com:9200"]
  index: "syncropel-audit-%{+yyyy.MM.dd}"

Each line becomes a single Elasticsearch document with full JSON parsing. Query in Kibana:

category: decision AND record.body.verdict: reject

Vector approach (lightweight alternative)

# /etc/vector/vector.toml
[sources.syncropel_audit]
type = "file"
include = ["/var/log/spl-audit/*.jsonl"]
read_from = "beginning"

[transforms.parse_json]
type = "remap"
inputs = ["syncropel_audit"]
source = '. = parse_json!(.message)'

[sinks.elastic]
type = "elasticsearch"
inputs = ["parse_json"]
endpoints = ["https://elastic.example.com:9200"]
mode = "data_stream"
data_stream.dataset = "syncropel-audit"

Vector is a single program with lower memory use than Filebeat. A good choice if you don't already run Beats.

Loki

Loki indexes labels rather than full text, so choose a few labels with few distinct values. Use category (4 distinct values) and an actor class (system, agent or user, taken from the DID prefix). Don't use the full DID or thread ID as a label: each distinct value creates a new stream, which makes Loki slow and expensive.

Promtail approach

# /etc/promtail/promtail.yml
scrape_configs:
  - job_name: syncropel-audit
    static_configs:
      - targets:
          - localhost
        labels:
          job: syncropel-audit
          host: ${HOSTNAME}
          __path__: /var/log/spl-audit/*.jsonl
    pipeline_stages:
      - json:
          expressions:
            category: category
            actor: record.actor
            verdict: record.body.verdict
      - regex:
          source: actor
          expression: '^did:sync:(?P<actor_class>[a-z]+):'
      - labels:
          category:
          actor_class:
      - timestamp:
          source: clock
          format: Unix

Query in Grafana / LogQL:

{job="syncropel-audit", category="decision"} | json | record.body.verdict="reject"
sum by (actor_class) (rate({job="syncropel-audit", category="dispatch"}[5m]))

Datadog

Use the Datadog agent's JSON log integration:

# /etc/datadog-agent/conf.d/syncropel_audit.d/conf.yaml
logs:
  - type: file
    path: /var/log/spl-audit/*.jsonl
    service: syncropel
    source: syncropel-audit
    log_processing_rules:
      - type: include_at_match
        name: include_jsonl
        pattern: ^\{

Datadog auto-detects JSON and creates facets for the nested fields. Query:

service:syncropel @category:decision @record.body.verdict:reject

Self-hosted minimal pipeline

If you don't have a SIEM and want the lightest possible setup, just rotate JSONL files on disk and grep them:

# /etc/logrotate.d/spl-audit
/var/log/spl-audit/*.jsonl {
    daily
    rotate 30
    compress
    missingok
    notifempty
    create 0644 syncropel syncropel
}

Then for any investigation:

# All decision rejections this week
zcat /var/log/spl-audit/audit-*.jsonl.gz /var/log/spl-audit/*.jsonl 2>/dev/null \
    | jq -c 'select(.category == "decision" and .record.body.verdict == "reject")'

# Dispatch cost in the last 24h
zcat /var/log/spl-audit/audit-*.jsonl.gz /var/log/spl-audit/*.jsonl 2>/dev/null \
    | jq -r 'select(.category == "dispatch") | .record.body.cost_usd' \
    | awk '{s+=$1} END {print s}'

# Records by a specific actor
zcat /var/log/spl-audit/audit-*.jsonl.gz /var/log/spl-audit/*.jsonl 2>/dev/null \
    | jq -c 'select(.record.actor == "did:sync:user:alice")'

You're not getting dashboards, but for solo or small-team deployments this is enough to satisfy compliance audits and post-incident investigation. Move to a real SIEM when log volume or query complexity demands it.

Companion: shipping the workspace log

To get a complete view, also ship ~/.syncro/logs/spl.log. It's in JSON Lines format, so the same shippers work.

# Filebeat example: ship both the audit export and the workspace log
filebeat.inputs:
  - type: filestream
    id: syncropel-audit
    paths:
      - /var/log/spl-audit/*.jsonl
    fields:
      stream: audit

  - type: filestream
    id: syncropel-instance-log
    paths:
      - /home/syncropel/.syncro/logs/spl.log
    parsers:
      - ndjson:
          target: ""
    fields:
      stream: instance

Filter for permission denials in the workspace log. They are not in the audit export:

index=security sourcetype=syncropel:instance "PERMISSION DENIED"

Operational checklist

Before declaring your audit pipeline production-ready:

  • Cron script runs successfully on a schedule
  • State file is written after each successful export
  • Output files are non-empty when there's activity (and empty files are cleaned up)
  • Shipper is tailing the output directory
  • First events visible in SIEM index
  • Tested filter for each of the 4 categories (system, decision, dispatch, governance)
  • Workspace log also being shipped (for permission denials)
  • Dedup strategy chosen (SIEM-side dedup on record.id is the easiest)
  • Logrotate or equivalent configured on the cron output
  • Alert rule for "no audit events for N minutes", which catches a broken pipeline before it matters
  • Retention policy aligned with your compliance requirements
  • Disk space monitoring on the output directory

Reference

On this page