Destinations and delivery

Send DefenseClaw logs, traces and metrics to an OTLP collector or other destination, narrow what each gets with send and routes, and tune queues.

A destination receives its own copy of every record it selects, with its own redaction, queue, retry and health. This page covers adding a destination, narrowing what it receives, and how delivery behaves when it fails. The overview explains buckets and defaults.

Destination kinds and fan-out

Destination kindSignals it receives
jsonl, console, splunk_hec, http_jsonllogs
prometheusmetrics
otlplogs, traces, metrics
otlp with preset: galileotraces

An enabled destination with no send or routes receives every bucket and every signal its kind supports. Each destination has its own filtering, redaction, queue, delivery and health.

observability:
  destinations:
    - name: engineering
      kind: otlp
      protocol: grpc
      endpoint: otel.example.com:4317
      headers:
        Authorization: {env: OTEL_AUTHORIZATION}
    - name: soc
      kind: splunk_hec
      endpoint: https://splunk.example.com:8088/services/collector/event
      token_env: SPLUNK_HEC_TOKEN

engineering receives all logs, traces and metrics. soc receives all logs. Both are unredacted.

Send to an OTLP collector

An OTLP destination receives logs, traces and metrics from the gateway. Use it for Datadog, Honeycomb, New Relic, Grafana Cloud or your own collector.

Before you start

  • The collector address, and a header or token if it needs one.
  • Store the token in an environment variable, not in a command line. Command-line values are visible to other users in ps.

Steps

  1. Add the destination.

    defenseclaw setup observability add otlp \
      --name engineering \
      --endpoint otel.example.com:4317 \
      --protocol grpc \
      --non-interactive
      Generic OTLP: added as destination 'engineering'
      Test it with: defenseclaw setup observability test engineering
      Saved. The gateway isn't running; it loads this destination when it starts (defenseclaw-gateway start).

    For a collector on this computer or a private network, add --allow-private-networks. If it has no TLS, add --plaintext too. Use --environment <name> to tell computers with the same host name apart.

  2. Narrow what it receives. With no filter, it gets every bucket and every signal. This sends only security logs and traces:

    observability:
      destinations:
        - name: engineering
          kind: otlp
          protocol: grpc
          endpoint: otel.example.com:4317
          send:
            signals: [logs, traces]
            buckets: [security.finding, enforcement.action]

    Edit ~/.defenseclaw/config.yaml, then run defenseclaw config validate. A running gateway applies a valid edit by itself. For filters by connector, action or severity, see routes and selectors.

  3. Review the result.

    defenseclaw observability plan --bucket security.finding --signal logs
    BUCKET            SIGNAL  COLLECT  DESTINATION   DECISION  ROUTE                                   REDACTION  …
    security.finding  logs    yes      local-sqlite  send      all-collected-logs-and-mandatory-floor  none       …
    security.finding  logs    yes      engineering   send      send                                    none       …

Check it worked

defenseclaw observability destination test engineering

The handshake checks connectivity; it does not prove delivery from the gateway. --write-probe is not supported for OTLP, because it would create ordinary logs, traces or metrics.

To check delivery, use an event in a bucket the destination receives:

  1. Run step 3 with that bucket and confirm engineering shows send. A clean agent call may record nothing in security.finding or enforcement.action, so with the step 2 filter it may send nothing.
  2. Find the event's ID in the local audit log.
  3. Find that ID at the collector or its backend.

The test connects from your shell, while the gateway delivers through the proxy it was started with. If the test passes but defenseclaw doctor reports delivery_failed, look for export failed lines in the gateway log.

Undo

defenseclaw setup observability disable engineering

disable keeps the entry. defenseclaw setup observability remove engineering deletes it.

Next

Narrow a destination

Use send for the common case:

observability:
  destinations:
    - name: soc
      kind: splunk_hec
      endpoint: https://splunk.example.com:8088/services/collector/event
      token_env: SPLUNK_HEC_TOKEN
      send:
        signals: [logs]
        buckets: [compliance.activity, security.finding, enforcement.action]
        redaction_profile: strict

Use ordered routes for filters by source, action or severity, and for exclusions:

observability:
  destinations:
    - name: archive
      kind: otlp
      protocol: http/protobuf
      endpoint: https://otel.example.com
      routes:
        - name: drop-diagnostics
          signals: [logs, traces, metrics]
          selector: {buckets: [diagnostic]}
          action: drop
        - name: high-security
          signals: [logs, traces]
          selector:
            buckets: [security.finding, enforcement.action]
            min_severity: HIGH
          action: send
          redaction_profile: sensitive
RuleBehavior
OrderThe first matching route wins, per destination and signal.
MatchingDifferent selector fields are ANDed. Values in one field are ORed.
No matchThe record is not sent to that destination.
Selectorsbuckets, sources, connectors, actions, event_names, min_severity.

To keep relationship records out of a destination, drop them ahead of the routes that send:

observability:
  destinations:
    - name: soc
      kind: splunk_hec
      endpoint: https://splunk.example.com:8088/services/collector/event
      token_env: SPLUNK_HEC_TOKEN
      routes:
        - name: drop-relationship-changes
          signals: [logs]
          selector: {event_names: [correlation.relationship.changed]}
          action: drop
        - name: everything-else
          signals: [logs]
          selector: {buckets: ["*"]}
          action: send

The mandatory floor is always written to local SQLite and never exported, whatever the routes say.

Tune bounded delivery

JSONL and console destinations take queue count and byte limits. Splunk HEC, HTTP JSONL and OTLP also take batch limits. Prometheus is pull-based and rejects batch.

FieldDefaultBounds
batch.max_queue_size20481..65536 records
batch.max_queue_bytes671088644198400..268435456 bytes
batch.max_export_batch_size5121..8192, no greater than queue count
batch.max_export_batch_bytes83886084263936..67108864 encoded bytes
batch.scheduled_delay_ms50001..600000. The Galileo preset defaults to 1000.
timeout_ms10000Positive, bounded milliseconds
  • Full queue. DefenseClaw drops the newest record, keeps older queued work and local history, and records the drop. Other destinations continue.
  • Transient failure. The exact projection stays queued for at most 24 attempts, with exponential backoff from 2 seconds to a cap of 30 seconds. A batch still unacknowledged after that is counted as dropped.
  • Gateway restart. Queued records are lost, and destinations are not backfilled from local history.
  • Duplicates. A lost acknowledgement can cause a duplicate, so consumers deduplicate on the record ID.

Destination failure circuits

Each destination and signal (logs, traces or metrics) has its own in-memory circuit.

FailureCircuit opens
Three consecutive terminal transient or permanent-payload batches30 seconds
Authentication failureAuthentication failures open the affected route immediately for five minutes; a half-open probe then retries it
Unsafe endpoint24 hours

While a circuit is open, work for that route stays in its bounded queue. When the queue fills, the newest record is dropped and counted. Other signals, other destinations and local SQLite continue. The oldest queued batch is the recovery probe: success closes the circuit and another failure reopens it.

defenseclaw doctor and gateway health show the state, failure count, failure class and open deadline. Transient-open and half-open states are warnings. An open authentication, permanent-payload or unsafe-endpoint circuit fails the check.

The defenseclaw.queue.drops metric counts lost records per destination.<name>.<signal> queue, with reason dropped (overflow, retry exhaustion, shutdown) or rejected. When the gateway stops before a destination takes its queue, gateway.log names each destination and count, and the next start adds them to the counters.

A circuit does not edit config.yaml. Fix the credential or endpoint and reload. To stop export, run defenseclaw setup observability disable NAME.

Edit the policy safely

Back up the file with private permissions, edit only deliberate overrides, and validate before relying on it:

defenseclaw config validate
defenseclaw config show --effective --section observability
defenseclaw observability plan
defenseclaw doctor

A running gateway applies a valid edit to buckets, redaction profiles and destinations without a restart, and keeps the previous policy if it rejects the edit. The Policy row of doctor shows which. The RELOAD column of observability plan says live_reloadable or restart_required per route. Only a Prometheus destination and observability.local.path need defenseclaw-gateway restart.

A global or bucket redaction profile also changes local SQLite. To redact only a remote destination, put the profile in that destination's send or route. See Redaction.