audit-archiver
audit-archiver stores every Massdriver event in one or more sinks: S3 (or an S3-compatible store), Splunk, Datadog, and a local directory.
Each sink gets the request body exactly as Massdriver signed it. The automation responds 204 only after every
configured sink accepted the event. When a sink fails, the automation responds 500, and Massdriver retries the
event. The retry writes only to the sinks that failed.
| Sink | What it writes |
|---|---|
| S3 | One object for each event, at <prefix>/YYYY/MM/DD/HH/<time>-<id>.json. The time is the event time in UTC, such as 20261124T055403.482913Z. The object has the content type application/cloudevents+json and the metadata webhook-id. A redelivered event writes the same key. |
| Splunk | One HEC event. event is the body as a string. time is the event time. The indexed fields are webhook_id and event_type. |
| Datadog | One log. message is the body as a string, and Datadog parses it as JSON. The log also has webhook_id, ddsource:massdriver, and the service and ddtags that you set. |
| Disk | One file for each event, at <dir>/YYYY/MM/DD/HH/<time>-<id>.json. A redelivered event overwrites its file. |
Settings​
The config file is YAML, at CONFIG_FILE (default /etc/massdriver-automations/config.yaml). Each section that is
set turns on its sink. Set at least one. An unknown key stops the automation at start.
config.example.yaml
has every key, with comments.
| Key | Default | |
|---|---|---|
s3.bucket | Required with s3. | |
s3.region | AWS_REGION | The region of the bucket. Use auto for Cloudflare R2. |
s3.prefix | events | The first part of each key. |
s3.endpoint | The URL of an S3-compatible store, such as MinIO or Cloudflare R2. The sink then uses path-style URLs. | |
s3.object_lock.mode | GOVERNANCE or COMPLIANCE. Each object gets this retention mode. The bucket must have Object Lock turned on. | |
s3.object_lock.days | Required with object_lock. Days to retain each object, counted from when the sink writes it. | |
splunk.url | Required with splunk. The base URL of the HTTP Event Collector, such as https://splunk.example.com:8088. | |
splunk.token_env | SPLUNK_HEC_TOKEN | The environment variable that holds the HEC token. |
splunk.index | Empty uses the default index of the token. | |
splunk.source | massdriver | |
splunk.sourcetype | massdriver:cloudevent | |
datadog.site | datadoghq.com | Your Datadog site, such as datadoghq.eu or us5.datadoghq.com. |
datadog.url | https://http-intake.logs.<site> | The intake URL, for a proxy. |
datadog.api_key_env | DD_API_KEY | The environment variable that holds the API key. |
datadog.service | massdriver | |
datadog.tags | Tags for each log, such as [env:prod, team:platform]. | |
disk.dir | Required with disk. The directory for the files. |
s3:
bucket: acme-massdriver-audit
region: us-east-1
prefix: events
object_lock:
mode: COMPLIANCE
days: 365
splunk:
url: https://splunk.example.com:8088
index: massdriver
datadog:
site: datadoghq.com
tags: [env:prod, team:platform]
The bundle's Settings params have the keys of the config file, with these differences:
- Each sink has an enabled toggle in place of the presence of its section.
- S3 Object Lock is
object_lock_days(0 sets no retention) andobject_lock_mode(defaultCOMPLIANCE), in place ofobject_lock. Region is required. splunk.token_env,datadog.api_key_env, anddatadog.urlare not params. The bundle reads theSPLUNK_HEC_TOKENandDD_API_KEYsecrets.- Disk writes inside the container, and a restart loses the files. Use it only to test.
Secrets​
| Variable | |
|---|---|
AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY | The S3 credentials. The sink also reads the other standard AWS sources: a profile, web identity (IRSA, EKS Pod Identity), or the instance or task role. |
AWS_REGION | The region of the bucket, when s3.region is not set. |
SPLUNK_HEC_TOKEN | The HEC token, or the variable that splunk.token_env names. |
DD_API_KEY | The Datadog API key, or the variable that datadog.api_key_env names. |
OTEL_EXPORTER_OTLP_HEADERS | Headers for the OTLP endpoint of Tracing, such as authorization=Bearer abc123. |
MASSDRIVER_SIGNING_SECRET is a common setting, and is
required. audit-archiver does not call the Massdriver API, so it needs no MASSDRIVER_API_KEY.
Permissions​
The automation needs no Massdriver permissions. When deployed with the bundle, the service account needs
organization:manageEventDestinations to create the destination.
The S3 credentials need s3:PutObject on the bucket. With Object Lock, they also need s3:PutObjectRetention.
On ECS, when the S3 sink is on, Endpoint is empty, and the AWS_ACCESS_KEY_ID secret is not set, the bundle
creates a task role that can call s3:PutObject on <bucket>/<prefix>/*, and s3:PutObjectRetention with Object
Lock.
Host​
The bundle serves the automation at Ingress > Host, such as audit-archiver.automations.acme.com. Only
/hooks/massdriver must be public. On ECS, an empty host uses audit-archiver.<domain of the cluster's hosted zone>.
Refer to Deploy.
Event destination​
The bundle creates a destination that selects every event: no event types, no attributes, and no condition. An attribute filter would drop the events that have no attributes, such as access token and service account events.
To create it yourself:
mass event destination create \
--name audit-archiver \
--url https://audit-archiver.example.com/hooks/massdriver
Copy the signing secret that the command prints into MASSDRIVER_SIGNING_SECRET.
The destination receives events that occur after you create it. To archive older events, read them with the
auditLogs query.
Run​
docker run -p 8080:8080 \
-v "$PWD/config.yaml:/etc/massdriver-automations/config.yaml:ro" \
-e MASSDRIVER_SIGNING_SECRET=whsec_... \
-e AWS_ACCESS_KEY_ID=... \
-e AWS_SECRET_ACCESS_KEY=... \
-e SPLUNK_HEC_TOKEN=... \
-e DD_API_KEY=... \
ghcr.io/massdriver-cloud/massdriver-automations:0.3 run audit-archiver
Limits​
- The automation stores the
webhook-idheader, which equals the eventid. It does not store thewebhook-timestampheader, which is the time of the delivery attempt, not of the event. - Each sink has 8 seconds to accept an event. A slower sink makes the event fail, and Massdriver retries it.
- The automation remembers which sinks hold an event for one hour, in memory. After a restart, or on a second
replica, a retry writes to every sink again. S3 writes the same key. Splunk and Datadog can then hold a duplicate;
use
webhook_idto drop it in a search. - In a bucket with versioning, which Object Lock needs, a redelivered event adds a version of the same key.
- Splunk responds
200when it receives an event, before it indexes it, unless the token uses indexer acknowledgment. The automation does not use acknowledgment. - The automation refuses a body larger than 1 MB. Datadog accepts a log of up to 1 MB.
- Some S3-compatible stores refuse the checksum headers of new AWS SDKs. Set
AWS_REQUEST_CHECKSUM_CALCULATION=when_requiredfor such a store. Do not set it for AWS S3 with Object Lock, which needs a checksum on each write.