Cloudflare DDoS Attack Analytics
Ingests Cloudflare DDoS attack analytics using the GraphQL Analytics API. This input collects detailed information about DDoS attacks detected and mitigated by Cloudflare, including attack metrics, mitigation actions, and network-layer attack vectors from the dosdAttackAnalyticsGroups dataset.
Sync Type: Incremental
Requirements
- A Cloudflare account with an Enterprise plan that includes Magic Transit, Spectrum, or Magic WAN
- An API Token with the
Account Analytics:Readpermission - Your Cloudflare Account ID
Plan Requirements
The DDoS Attack Analytics API is only available to Enterprise customers with specific add-ons:
| Add-on | Availability |
|---|---|
| Magic Transit | Enterprise only |
| Spectrum | Enterprise only |
| Magic WAN | Enterprise only |
If your account does not have one of these services enabled, you will not have access to DDoS attack analytics data.
Creating an API Token
- Log in to your Cloudflare dashboard
- Navigate to My Profile > API Tokens
- Click Create Token
- Use the Create Custom Token option
- Configure the token:
- Token name: Give it a descriptive name (e.g., "Monad DDoS Attack Analytics")
- Permissions: Add
Account>Account Analytics>Read - Account Resources: Select the specific account(s) or "All accounts"
- Click Continue to summary and then Create Token
- Copy the token value (you won't be able to see it again)
Finding Your Account ID
- Log in to your Cloudflare dashboard
- Select the account you want to monitor
- The Account ID is displayed in the right sidebar on the overview page
- Alternatively, find it in the URL:
https://dash.cloudflare.com/{account_id}/...
Details
- State Management: Uses timestamp-based incremental sync with attack ID deduplication. Monad stores the last processed event timestamp and attack ID to fetch only new attacks on subsequent runs.
- API Endpoint: GraphQL Analytics API (
/graphql) - Dataset:
dosdAttackAnalyticsGroups - Pagination: Time-window based pagination. The API defines maximum query duration and retention limits. The input automatically chunks requests into time windows to handle large time ranges while respecting API constraints.
- Rate Limits: 300 requests per 5 minutes (1 request per second). The input automatically enforces this limit.
- Data Retention: The API provides attack data with specific retention periods (typically 30 days for standard retention, extensible for Enterprise customers). The input respects retention limits and adjusts queries accordingly.
- Time Window Optimization: Queries are automatically windowed to the API's maximum query duration (typically 1 hour) to prevent timeouts on large date ranges.
Configuration
Settings
| Setting | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | Cloudflare Account ID (32-character alphanumeric string) |
backfill_start_time | string | No | The date to start fetching data from. If not specified, no past records will be fetched. |
Secrets
| Secret | Type | Required | Description |
|---|---|---|---|
api_token | string | Yes | Cloudflare API Token with Account Analytics:Read permission |
Rate Limits
| Limit | Value | Notes |
|---|---|---|
| Requests per 5 minutes | 300 | GraphQL Analytics API limit |
| Requests per second | 1 | Enforced by rate limiter |
| Data retention | 30 days | Standard retention; Enterprise plans may have extended retention |
| Max query duration | 1 hour | Automatic time windowing is applied |
Headers: Authorization: Bearer <api_token>
Source: Cloudflare DDoS Protection Analytics API Reference
Troubleshooting
Common Issues
Issue: GraphQL error with authentication message
Cause: The API token is invalid, expired, or lacks the required permissions.
Solution: Verify your API token is correct and has the Account Analytics:Read permission. Create a new token if needed.
Issue: Account ID is required validation error
Cause: The Account ID field was left empty.
Solution: Enter your Cloudflare Account ID in the settings. You can find this in your Cloudflare dashboard.
Issue: invalid backfill_start_time format error
Cause: The backfill start time is not in RFC3339 format.
Solution: Use valid RFC3339 format like 2024-01-15T10:30:00Z or 2024-01-15T10:30:00+00:00.
Issue: Feature not available error
Cause: Your account does not have Enterprise plan with Magic Transit, Spectrum, or Magic WAN enabled.
Solution: Contact Cloudflare sales to enable DDoS Attack Analytics for your account.
Issue: No data returned despite DDoS attacks occurring Cause: The backfill start time may exceed your plan's data retention, or there may be no attacks in the time range. Solution: Check your plan's data retention limits. Adjust the backfill start time to stay within the retention window (typically 30 days).
Issue: Queries timeout or fail with max_duration exceeded
Cause: The time range is too large for a single query.
Solution: The input automatically handles this by windowing queries to 1-hour intervals. This is normal and will resolve automatically.
Issue: API returned success=false with permission error
Cause: The API token lacks proper permissions for DDoS attack data access.
Solution: Verify the token has Account Analytics:Read permission. Some organizations may require additional security reviews before accessing this data.
Related Articles
- Cloudflare DDoS Protection Analytics API
- Cloudflare DDoS Protection Overview
- GraphQL Analytics API Migration Guides
- Cloudflare API Tokens
Sample Record
{
"attackId": "550e8400-e29b-41d4-a716-446655440000",
"attackType": "udp",
"attackVector": "UDP Flood",
"bits": 2500000000,
"packets": 1500000,
"droppedBits": 2500000000,
"droppedPackets": 1500000,
"startDatetime": "2024-01-15T10:30:00Z",
"endDatetime": "2024-01-15T10:31:00Z",
"sourceIp": "203.0.113.25",
"sourcePort": 12345,
"destinationIp": "198.51.100.42",
"destinationPort": 53,
"ipProtocol": 17,
"ipProtocolName": "udp",
"mitigationType": "dosd",
"mitigationReason": "auto_mitigation",
"mitigationScope": "global",
"ruleId": "c41d8cd98f00b204e9800998ecf8427e",
"ruleName": "DDoS Attack Prevention",
"rulesetId": "d41d8cd98f00b204e9800998ecf8427e",
"rulesetOverrideId": "",
"tcpFlags": 0,
"tcpFlagsNames": "",
"commonTcpFlags": 0,
"commonTcpFlagsNames": ""
}