# SIEM destinations

> Set up Splunk, Datadog, Microsoft Sentinel, Elastic or a signed webhook to receive Thoth's decisions, and check that they arrive.

Source: https://docs.atensecurity.com/docs/operations/siem-destinations

The [decision stream](https://docs.atensecurity.com/docs/operations/siem-decision-stream) sends each enforcement decision to
one SIEM destination: a provider, an HTTPS URL and, for most providers, an endpoint token. This
page covers each provider: the URL to use, the token it needs, what Thoth sends, and where to look
for it.

## Setting the destination

The token is a secret, so set it from a file with `thothctl`, or through a sensitive Terraform
variable. Never put it on the command line.

```bash
thothctl settings set --siem-provider splunk --siem-enabled true \
  --siem-url https://splunk.example.com:8088/services/collector \
  --siem-secret-file ./hec-token
```

```terraform
resource "thoth_siem_settings" "this" {
  siem_provider         = "splunk"
  siem_webhook_provider = "splunk"
  siem_webhook_enabled  = true
  siem_webhook_url      = "https://splunk.example.com:8088/services/collector"
  siem_webhook_secret   = var.splunk_hec_token
}
```

`--siem-provider` and `siem_provider` take `splunk`, `datadog`, `sentinel`, `elastic` or `custom`.
The URL must start with `https://`. Reads return `[redacted credential]` in place of a stored
token, never the token. From an MCP client, admins can change the provider, URL and whether the
destination is on with `preview_workspace_settings`, committed like any
[configuration preview](https://docs.atensecurity.com/docs/mcp/configure-thoth). The token stays with `thothctl` and
Terraform. Then turn the stream on, as described in
[Turning it on](https://docs.atensecurity.com/docs/operations/siem-decision-stream#turning-it-on).

Splunk, Datadog and Sentinel need a token to receive decisions in their own format. Without one,
Thoth sends the [signed webhook](#signed-webhook) body instead, which those services won't accept.

## Splunk HTTP Event Collector

- **URL:** your HEC endpoint, for example `https://splunk.example.com:8088/services/collector`.
- **Token:** a HEC token, sent as `Authorization: Splunk <token>`.
- **What arrives:** one HEC event per decision. The event carries `source` `thoth-eventingestor`
  and `sourcetype` `_json`, its `time` is the decision's time, and its `event` is the
  `thoth.decision/v1` record.

```json
{
  "time": 1792836000,
  "source": "thoth-eventingestor",
  "sourcetype": "_json",
  "event": { "schema": "thoth.decision/v1", "decision": "BLOCK", "…": "…" }
}
```

To find them: `source="thoth-eventingestor" sourcetype="_json"`.

## Datadog

- **URL:** the logs intake for your Datadog site. For US1 that is
  `https://http-intake.logs.datadoghq.com/api/v2/logs`; other sites use their own intake host.
- **Token:** a Datadog API key, sent as `DD-API-KEY`.
- **What arrives:** one log per decision, with `ddsource` `thoth` and `service`
  `thoth-eventingestor`. The record is the log's `message` (as JSON text) and its `attributes`, so
  its fields can be faceted.

To find them: `source:thoth service:thoth-eventingestor`.

## Microsoft Sentinel

Sentinel's own ingestion API needs an Entra ID access token, which Thoth doesn't obtain. Point Thoth
at an endpoint you run instead, such as a Logic App or an Azure Function with an HTTP trigger,
which checks the request and forwards the records to your Sentinel workspace.

- **URL:** your forwarding endpoint.
- **Token:** a shared secret of your choosing. Thoth sends it as `Authorization: Bearer <secret>`,
  and signs the body with it in `X-Thoth-Sentinel-Signature: sha256=<hex>`, where `<hex>` is the
  HMAC-SHA256 of the raw body, keyed with the secret.
- **What arrives:** a batch with one record per request:

```json
{
  "provider": "sentinel",
  "generated_at": "2026-10-24T10:00:00+00:00",
  "records": [{ "schema": "thoth.decision/v1", "decision": "BLOCK", "…": "…" }]
}
```

Your endpoint should check the signature before forwarding `records`.

## Elastic

- **URL:** your index's bulk endpoint, for example
  `https://elastic.example.com:9200/thoth-decisions/_bulk`. The bulk action doesn't name an index,
  so the URL must.
- **Token:** optional. When set, it is sent as `Authorization: ApiKey <key>`, so use an encoded
  Elastic API key with permission to index documents.
- **What arrives:** an `application/x-ndjson` bulk request indexing one document per decision.
  The document is the record, with `@timestamp` added if it has none and `provider` `elastic`.

## Signed webhook

Choose `custom` for any other HTTPS endpoint, such as a SOAR, a queue or your own collector.

- **URL:** your endpoint.
- **Token:** optional, and used only to sign. When set, each request carries
  `X-Thoth-Signature: sha256=<hex>`, the HMAC-SHA256 of the raw body keyed with it.
- **What arrives:** the `thoth.decision/v1` record as JSON (`Content-Type: application/json`),
  one per request.

Check the signature against the raw body, before parsing it:

```python
import hashlib
import hmac


def is_from_thoth(body: bytes, header: str, secret: str) -> bool:
    expected = "sha256=" + hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, header)
```

## Checking delivery

A destination that answers with anything but a 2xx is retried up to three times over a few
seconds, then counted as failed. Read delivery health with:

```bash
thothctl settings decision-stream get
```

It shows when a record was last delivered, and the last failure and its reason: `http_<status>`
for a response such as `http_401` (usually the token), or `timeout` or `connect` when Thoth couldn't
reach the URL.
