Cloudflare DDoS Attack Analytics
Beta Feature
This input is currently in beta. If you run into any issues, please reach out to product@monad.com.
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 to prevent timeouts on large date ranges. The input reads the maximum query duration from Cloudflare's dataset settings at run time, and uses 1 hour only if that setting can't be read.
- Attack updates: Each attack is collected once, when it starts. Later changes to an ongoing attack are not collected again.
- Late-arriving events: Each sync reads up to the current time, so an event that Cloudflare makes available later than newer events already collected can be missed.
Configuration
Settings
| Setting | Type | Required | Default | Description |
|---|---|---|---|---|
account_id | string | Yes | - | Cloudflare Account ID |
backfill_start_time | date | No | - | Date to start fetching attacks from. If not specified, the first sync starts at the oldest time Cloudflare retains for this dataset (30 days if Cloudflare doesn't report a limit). Earlier dates are moved forward to that limit. |
use_synthetic_data | bool | No | false | Generate synthetic data for testing, instead of connecting to a real data source. Defaults to an hourly cron schedule for cron-based inputs. |
rate_limit | object | No | - | Maximum outbound source-API request rate. A blank or zero value falls back to the connector's default rate-limiting behavior. Maximum 1 requests per second. See API Rate Limiting for the field format. |
Secrets
| Secret | Type | Required | Description |
|---|---|---|---|
api_token | secret | Yes | Cloudflare API Token with Account Analytics Read permissions |
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 | Dynamic | Read from Cloudflare's dataset settings at run time (fallback: 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 the maximum query duration reported by Cloudflare.
This is normal and will resolve automatically.
Related Articles
- Cloudflare DDoS Protection Analytics API
- Cloudflare DDoS Protection Overview
- GraphQL Analytics API Migration Guides
- Cloudflare API Tokens
Sample Record
Code
Sync frequency
By default this input polls approximately every 10 seconds, with each sync beginning after the previous one completes. A cron schedule configured on the pipeline overrides this cadence. See Input Sync Frequency for details.
Community transforms
The Monad Transforms Repository has ready-made transforms for this input. Import one into your organization, then add it to a pipeline after this input.
| Format | Transform |
|---|---|
| OCSF v1.9.0 | Cloudflare DDoS Attack Analytics to OCSF v1.9.0 |
| ECS v9.5.0 | Cloudflare DDoS Attack Analytics to ECS v9.5.0 |
| CEF | Cloudflare DDoS Attack Analytics to CEF |
CEF transforms emit an intermediate record; add the CEF Serializer transform after one to produce the CEF:0 string.