Rules
Magic Network Monitoring rules allow you to monitor your network traffic for DDoS attacks on specific IP addresses or IP prefixes within your network. If the network traffic that is monitored by a rule exceeds the rule's threshold or contains a DDoS attack fingerprint, then you will receive an alert.
There are three different types of rules that can be configured within Magic Network Monitoring. You can refer to the linked documentation page for each rule type to learn more.
Rule Type | Rule Description | Rule Availability |
---|---|---|
Dynamic threshold (recommended) | A dynamic threshold rule will analyze a network's traffic patterns over time and automatically adjust the rule's DDoS threshold, in terms of bits or packets, based on traffic history. | API configuration only |
Static threshold | A static threshold rule allows you to define a constant numeric threshold, in terms of bits or packets, for DDoS traffic monitoring. | API configuration and dashboard configuration |
sFlow DDoS attack | Magic Network Monitoring customers that send sFlow data to Cloudflare can receive alerts when a specific type of distributed denial-of-service (DDoS) attack is detected within their network traffic. | API configuration only. Only applicable to sFlow data sets |
You can only configure static traffic threshold rules in the Cloudflare dashboard.
To create a new rule:
- Log in to the Cloudflare dashboard ↗, and select your account.
- Go to Analytics & Logs > Magic Monitoring.
- Select Configure Magic Network Monitoring > Add new rule.
- Create a new static traffic threshold rule according to your needs. Refer to the documentation on static threshold rules for more information on each field in the static threshold rule's configuration.
- Select Create a new rule when you are finished.
- Log in to the Cloudflare dashboard ↗, and select your account.
- Go to Analytics & Logs > Magic Monitoring.
- Select Configure Magic Network Monitoring.
- Find the static threshold rule you want to edit, and select Edit.
- Edit the appropriate fields. Refer to Rule configuration fields for more information on what each field does.
- Select Save when you are finished.
- Log in to the Cloudflare dashboard ↗, and select your account.
- Go to Analytics & Logs > Magic Monitoring.
- Select Configure Magic Network Monitoring.
- Find the static threshold rule you want to delete, and select Delete.
- Select I understand that deleting a rule is permanent, and select Delete again.
If you are an Enterprise customer using Magic Transit On Demand, you can enable Auto-Advertisement for any dynamic threshold, static threshold, and sFlow DDoS attack rule. The Auto-Advertisement feature will automatically activate Magic Transit when a static or dynamic rule threshold is exceeded or a DDoS attack fingerprint is identified in sFlow traffic logs.
Follow the previous steps to create or edit a rule. Then, enable Auto-Advertisement.
Each rule must include a group of IP prefixes in its definition. All IP prefixes inside a rule are evaluated as a whole, and you should set up a rule with multiple IP prefixes when you want the IP prefixes' aggregated traffic to trigger an alert or advertisement. For thresholds on singular IP prefixes or IP addresses, you can create an individual rule with one prefix and the desired rule parameters.
For a rule with two prefix CIDRs and a packet_threshold
of 10000
as shown below, the rule will be flagged if the joint packet traffic of 192.168.0.0/24
and 172.118.0.0/24
is greater than 10000
. This also means that Cloudflare attempts to auto advertise both CIDRs if the rule has the auto advertisement flag enabled. Customers can also configure Rule IP prefixes at scale via Cloudflare's API ↗.
"rules":[ "name": "Too many packets", "prefixes": ["192.168.0.0/24", "172.118.0.0/24"], "packet_threshold": 10000, "automatic_advertisement": true, "duration": "1m0s", "type": "threshold" ]
For more granular thresholds, create a more focused rule as shown below.
"rules":[ "name": "Too many packets", "prefixes": ["172.118.0.0/24"], "packet_threshold": 1000, "automatic_advertisement": true, "duration": "1m0s", "type": "threshold" ]
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark