Write every Script Monitoring alert to your own Amazon S3 bucket as a JSON Lines file: the write-only bucket policy, the file format, and fixes.
An S3 destination writes each Script Monitoring alert to an Amazon S3 bucket you own, as its own JSON Lines file. You add it to an alert rule under Settings > Destinations, and the only setup on the AWS side is one write-only statement in the bucket's policy. S3 destinations are on Pro and Enterprise.
How do I set up the bucket?#
Add this statement to the bucket's policy, with your bucket name in place of <your-bucket>. The dashboard's Copy policy button copies it with your bucket name already filled in:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowScriptMonitoringNotifications",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::291679136427:role/script-monitoring-destinations"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::<your-bucket>/*"
}
]
}
Two bucket settings matter as well:
- Object Ownership: Bucket owner enforced, the S3 default, so your account owns every file Script Monitoring writes. With ACLs turned on, the files are written but your account can't read them.
- Default encryption: SSE-S3, the S3 default. Script Monitoring has no access to your KMS keys, so a bucket that defaults to SSE-KMS denies the write.
How do I add an S3 destination?#
In Settings > Destinations, open a rule (or New rule), click S3 under Where to, and fill in:
| Field | What to enter |
|---|---|
| Bucket | The bucket's name, such as acme-security-alerts |
| Region | The bucket's AWS region, such as us-east-1 |
| Path prefix | Optional. A folder for the files, such as script-monitoring/ |
Click Save and send test, and check that a .jsonl file appears under the path prefix. See Destinations for the rest of the rule.
What does Script Monitoring write?#
One file per alert, never overwritten, at:
<path prefix>/alerts/team=<team ID>/dt=<YYYY-MM-DD>/<id>.jsonl
The date is the UTC day the alert was sent. Each file holds one line: the same JSON a webhook receives, alert.created for a script alert or security_headers.changed for a security header change, followed by a newline. The team= and dt= folders let Amazon Athena, AWS Glue or a SIEM read the files as a partitioned table.
Why didn't a file arrive?#
| What you see | Usual cause | Fix |
|---|---|---|
| Nothing under the prefix, access denied | The policy is missing, names another bucket, or the bucket defaults to SSE-KMS | Copy the policy again from the dashboard, check the bucket name, switch default encryption to SSE-S3 |
| Nothing at all | The bucket name or region is wrong | Check both against the bucket in the AWS console |
| Files you can't open | Object Ownership has ACLs turned on | Set Object Ownership to Bucket owner enforced |
Script Monitoring retries a write that times out or fails on the S3 side. An access-denied write is not retried, so fix the policy, then click Save and send test again. A rule's Last delivery column shows when it last delivered, by any channel.
How do I tell a test from a real alert?#
In a test script alert (alert.created), data.ruleset_id is TEST_FAKE_ALERT, the same as for webhooks.
Frequently asked questions#
Can Script Monitoring read or delete files in my bucket?
No. The policy grants s3:PutObject only, so Script Monitoring can add files but can't read, list, change or delete anything.
Does S3 export work with SSE-KMS encryption?
Not as the bucket's default encryption. Script Monitoring has no access to your KMS keys, so a write to a bucket that defaults to SSE-KMS is denied. Use SSE-S3, the S3 default.
Are files ever overwritten?
No. Each alert gets its own file, and a retry writes the same file name with the same contents. An existing file is never replaced.
Which plans include S3 export?
Pro and Enterprise. See Plans.