diff --git a/public/__redirects b/public/__redirects index 4f4e27950ef997a..40bccf4c7328ad4 100644 --- a/public/__redirects +++ b/public/__redirects @@ -791,6 +791,9 @@ # magic-network-monitoring /magic-network-monitoring/routers/ /magic-network-monitoring/routers/supported-routers/ 301 /magic-network-monitoring/tutorials/ /magic-network-monitoring/tutorials/graphql-analytics/ 301 +/magic-network-monitoring/rules/recommended-rule-configuration/ /magic-network-monitoring/rules/static-threshold/ 301 +/magic-network-monitoring/rules/sflow-ddos-alerts/ /rules/configure-rule-notifications/ 301 +/magic-network-monitoring/notifications/ /rules/rule-notifications/ 301 # magic-transit /magic-transit/magic-firewall/ /magic-firewall/ 301 diff --git a/src/content/docs/magic-network-monitoring/index.mdx b/src/content/docs/magic-network-monitoring/index.mdx index ec10ad12688d40b..7b3752eb6c4cb74 100644 --- a/src/content/docs/magic-network-monitoring/index.mdx +++ b/src/content/docs/magic-network-monitoring/index.mdx @@ -52,7 +52,7 @@ Magic Transit On Demand customers can use Magic Network Monitoring to enable DDo - + Set up notifications to learn about an attack. diff --git a/src/content/docs/magic-network-monitoring/notifications.mdx b/src/content/docs/magic-network-monitoring/notifications.mdx deleted file mode 100644 index 9891a184e0ff9a4..000000000000000 --- a/src/content/docs/magic-network-monitoring/notifications.mdx +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Notifications -pcx_content_type: how-to -sidebar: - order: 6 - ---- - -You can receive Magic Network Monitoring notifications via email, PagerDuty, or webhooks. - -For more information on receiving notifications via PagerDuty or using webhooks, refer to [Create a notification](/notifications/get-started/#create-a-notification). - -1. Log in to your [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account. -2. Select **Notifications** > **Add**. -3. Locate **Magic Transit** > **Magic Network Monitoring: Volumetric Attack** in the list, and choose **Select** to add a notification. -4. Enter a name and description for the notification. -5. Add an email address for the person who should receive the notification. -6. Select **Create** when you are done. diff --git a/src/content/docs/magic-network-monitoring/rules/dynamic-threshold.mdx b/src/content/docs/magic-network-monitoring/rules/dynamic-threshold.mdx new file mode 100644 index 000000000000000..28424f7b0de1463 --- /dev/null +++ b/src/content/docs/magic-network-monitoring/rules/dynamic-threshold.mdx @@ -0,0 +1,45 @@ +--- +title: Dynamic threshold rule +pcx_content_type: how-to +sidebar: + order: 2 + badge: + text: Beta +--- + +A dynamic threshold rule (beta) 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. The total traffic across all IP prefixes and IP addresses in the rule is compared to the current value of the dynamic threshold. If the total traffic exceeds the dynamic threshold, then an alert is sent. + +Dynamic thresholds are calculated using a statistical measure called [Z-score](https://en.wikipedia.org/wiki/Standard_score) (also referred to as standard score). Review [How the dynamic rule threshold is calculated](#how-the-dynamic-rule-threshold-is-calculated) to learn more. + +Customers that send NetFlow and/or sFlow data to Cloudflare can configure dynamic threshold rules. + +A dynamic threshold rule can only be configured via [Cloudflare's Magic Network Monitoring Rules API](/api/resources/magic_network_monitoring/subresources/rules/). Today, customers are unable to configure dynamic threshold rules in the Cloudflare dashboard. + +## Rule configuration fields + +| Field | Description | +| :---- | :---- | +| **Rule name** | Must be unique and cannot contain spaces. Supports characters `A-Z`, `a-z`, `0-9`, underscore (`_`), dash (`-`), period (`.`), and tilde (`~`). Maximum of 256 characters. | +| **Rule type** | zscore | +| **Target** | Can be defined in either bits per second or packets per second. | +| **Sensitivity** | Z-Score sensitivity has three values: low, medium, and high. | +| **Auto-advertisement** | If you are a [Magic Transit On Demand](/magic-transit/on-demand) customer, you can enable this feature to automatically enable Magic Transit if the rule's dynamic threshold is triggered. To learn more and see an example, view the [Auto-Advertisement section](/magic-network-monitoring/rules/rule-notifications/#rule-auto-advertisement-notifications). | +| **Rule IP prefix** | The IP prefix associated with the rule for monitoring traffic volume. Must be a CIDR range such as `160.168.0.1/24`. The maximum is 5,000 unique CIDR entries. To learn more and review an example, refer to the [Rule IP prefixes](/magic-network-monitoring/rules/#rule-ip-prefixes). | + +## API documentation + +to review an example API configuration call using CURL and the expected output for a successful response, go to [Magic Network Monitoring](/api/resources/magic_network_monitoring/) in [developers.cloudflare.com/api/](/api/) and expand the [Rules](/api/resources/magic_network_monitoring/subresources/rules/) section. + +## How the dynamic rule threshold is calculated + +Dynamic thresholds for this rule type are calculated using a statistical measure called Z-Score. The dynamic threshold for this rule will automatically adjust based on your traffic history as this rule uses statistical analysis to detect traffic anomalies. Z-Score is calculated by comparing short-term traffic patterns (five-minute time window) against long-term baselines (four-hour time window) . + +Z-Score is calculated by using the following formula: + +```txt +Z = (X - μ) / σ +``` + +- `X` = Current traffic value. +- `μ` = Mean traffic value over the long window. +- `σ` = Standard deviation over the long window. \ No newline at end of file diff --git a/src/content/docs/magic-network-monitoring/rules/index.mdx b/src/content/docs/magic-network-monitoring/rules/index.mdx index 991fcabaad5aaa8..4607485642f4f80 100644 --- a/src/content/docs/magic-network-monitoring/rules/index.mdx +++ b/src/content/docs/magic-network-monitoring/rules/index.mdx @@ -2,12 +2,26 @@ title: Rules pcx_content_type: how-to sidebar: - label: Manage rules + label: Overview order: 4 --- -Magic Network Monitoring rules will allow you to monitor the traffic volume destined for IP addresses or IP prefixes on your network. You can also receive alerts if the volume of traffic arriving at specific destinations exceeds a defined threshold. +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. + +## Rule types + +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](/magic-network-monitoring/rules/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](/magic-network-monitoring/rules/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/rules/s-flow-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 | + +## Create rules in the dashboard + +You can only configure static traffic threshold rules in the Cloudflare dashboard. :::caution[Invalid account settings error when trying to create a rule] If you get the following error when trying to create a rule: @@ -19,88 +33,67 @@ Make sure the name for your Cloudflare account does not contain unsupported char Refer to [Account name](/fundamentals/setup/account/customize-account/account-name/) to learn how to change your account name. ::: - -## Create rules - -Refer to [Recommended rule configuration](/magic-network-monitoring/rules/recommended-rule-configuration/) for more details on the settings we recommend to create appropriate Magic Network Monitoring rules. +To create a new rule: 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account. 2. Go to **Analytics & Logs** > **Magic Monitoring**. 3. Select **Configure Magic Network Monitoring** > **Add new rule**. -4. Create your rule according to your needs. Refer to [Rule fields](#rule-fields) for more information on what each field does. +4. Create a new static traffic threshold rule according to your needs. Refer to the documentation on [static threshold](/magic-network-monitoring/rules/static-threshold/) rules for more information on each field in the static threshold rule's configuration. 5. Select **Create a new rule** when you are finished. -## Edit or delete rules +## Edit rules in the dashboard 1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account. 2. Go to **Analytics & Logs** > **Magic Monitoring**. 3. Select **Configure Magic Network Monitoring**. -4. Find the rule you want to edit, and select **Edit**. Optionally, you can also select **Delete** to delete a rule. -5. Edit the appropriate fields. Refer to [Rule fields](#rule-fields) for more information on what each field does. +4. Find the static threshold rule you want to edit, and select **Edit**. +5. Edit the appropriate fields. Refer to [Rule configuration fields](/magic-network-monitoring/rules/static-threshold/#rule-configuration-fields) for more information on what each field does. 6. Select **Save** when you are finished. -## Rule Auto-Advertisement +## Delete rules in the dashboard -If you are an Enterprise customer using [Magic Transit On Demand](/magic-transit/on-demand), enable **Auto-Advertisement** if you want to automatically activate Magic Transit when a certain threshold is exceeded. +1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account. +2. Go to **Analytics & Logs** > **Magic Monitoring**. +3. Select **Configure Magic Network Monitoring**. +4. Find the static threshold rule you want to delete, and select **Delete**. +5. Select **I understand that deleting a rule is permanent**, and select **Delete** again. -Follow the previous steps to [create](#create-rules) or [edit](#edit-or-delete-rules) a rule. Then, make sure you enable **Auto-Advertisement**. +## Common settings that apply to all rule types -## Rule fields +### Rule Auto-Advertisement -| Field | Description | -| ----------------------- | ----------- | -| **Rule name** | Must be unique and cannot contain spaces. Supports characters `A-Z`, `a-z`, `0-9`, underscore (`_`), dash (`-`), period (`.`), and tilde (`~`). Max 256 characters. | -| **Rule threshold type** | Can be defined in either bits per second or packets per second. | -| **Rule threshold** | The number of bits per second or packets per second for the rule alert. When this value is exceeded for the rule duration, an alert notification is sent. Minimum of `1` and no maximum. | -| **Rule duration** | The amount of time in minutes the rule threshold must exceed to send an alert notification. Choose from the following values: `1`, `5`, `10`, `15`, `20`, `30`, `45`, or `60` minutes. | -| **Auto-advertisement** | If you are a [Magic Transit On Demand](/magic-transit/on-demand) customer, you can enable this feature to automatically enable Magic Transit if the rule alert is triggered.| -| **Rule IP prefix** | The IP prefix associated with the rule for monitoring traffic volume. Must be a CIDR range such as `160.168.0.1/24`. Max is 5,000 unique CIDR entries. | +If you are an Enterprise customer using [Magic Transit On Demand](/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. -## Enable per-prefix thresholds with the API +Follow the previous steps to [create](#create-rules-in-the-dashboard) or [edit](#edit-rules-in-the-dashboard) a rule. Then, enable **Auto-Advertisement**. -You can also use the [Magic Network Monitoring API](/api/resources/magic_network_monitoring/subresources/rules/methods/list/) to configure custom thresholds for specific prefixes. +### Rule IP prefixes -The system uses the concept of rules, and each rule consists of a group of prefixes. All prefixes inside a rule are evaluated as a whole, and you should set up a rule if you want the prefixes' aggregated traffic to trigger an alert or advertisement. For thresholds on singular prefixes or IPs, you can create an individual rule with one prefix and the desired threshold. +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. -### Example +### Rule IP prefixes example -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 in case the flag is turned on. +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](https://developers.cloudflare.com/api/resources/magic_network_monitoring/subresources/rules/). -```bash +```json "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. -```bash +```json "rules":[ "name": "Too many packets", "prefixes": ["172.118.0.0/24"], "packet_threshold": 1000, "automatic_advertisement": true, "duration": "1m0s", + "type": "threshold" ] -``` - -Refer to the [Magic Network Monitoring API documentation](/api/resources/magic_network_monitoring/subresources/rules/methods/list/) for more information. - -## Notifications - -Webhook, PagerDuty, and email notifications are sent following an auto-advertisement attempt for all prefixes inside the flagged rule. - -You will receive the status of the advertisement for each prefix with the following available statuses: - -- **Advertised**: The prefix was successfully advertised. -- **Already Advertised**: The prefix was advertised prior to the auto advertisement attempt. -- **Delayed**: The prefix cannot currently be advertised but will attempt advertisement. After the prefix can be advertised, a new notification is sent with the updated status. -- **Locked**: The prefix is locked and cannot be advertised. -- **Could not Advertise**: Cloudflare was unable to advertise the prefix. This status can occur for multiple reasons, but usually occurs when you are not allowed to advertise a prefix. -- **Error**: A general error occurred during prefix advertisement. - -Refer to [Notifications](/magic-network-monitoring/notifications/) to learn how to create one. +``` \ No newline at end of file diff --git a/src/content/docs/magic-network-monitoring/rules/rule-notifications.mdx b/src/content/docs/magic-network-monitoring/rules/rule-notifications.mdx new file mode 100644 index 000000000000000..9eb9b6a6ba9d482 --- /dev/null +++ b/src/content/docs/magic-network-monitoring/rules/rule-notifications.mdx @@ -0,0 +1,73 @@ +--- +title: Configure rule notifications +pcx_content_type: how-to +sidebar: + order: 4 +--- + +After configuring one or multiple rule types in Magic Network Monitoring, customers can also choose to receive notifications via email, webhook, or PagerDuty when a rule is triggered. + +Customers can configure multiple rule types and alerts together to create layers of DDoS protection based on their network environment and their security needs. + +You can read [Cloudflare's Notifications documentation](/notifications/) for more information on our notification platform including: + +- [Configure Cloudflare notifications](/notifications/get-started/) +- [Configure PagerDuty](/notifications/get-started/configure-pagerduty/) +- [Configure webhooks](/notifications/get-started/configure-webhooks/) +- [Test a notification](/notifications/get-started/#test-a-notification) +- [Notification History](/notifications/notification-history/) + +## Magic Network Monitoring notification configuration fields + +| Field | Description | +| :---- | :---- | +| **Notification name** | The name of the Magic Network Monitoring notification (MNM) for the rule type that was selected. | +| **Description (optional)** | The description of the MNM notification. | +| **Webhooks** | The webhook(s) that will receive the MNM notification. | +| **Notification email** | The email(s) that will receive the MNM notification. | + +## Rule Auto-Advertisement notifications + +Webhook, PagerDuty, and email notifications are sent following an auto-advertisement attempt for all prefixes inside the flagged rule. + +You will receive the status of the advertisement for each prefix with the following available statuses: + +- **Advertised**: The prefix was successfully advertised. +- **Already Advertised**: The prefix was advertised prior to the auto advertisement attempt. +- **Delayed**: The prefix cannot currently be advertised but will attempt advertisement. After the prefix can be advertised, a new notification is sent with the updated status. +- **Locked**: The prefix is locked and cannot be advertised. +- **Could not Advertise**: Cloudflare was unable to advertise the prefix. This status can occur for multiple reasons, but usually occurs when you are not allowed to advertise a prefix. +- **Error**: A general error occurred during prefix advertisement. + +## Configure static threshold notifications + +To configure static threshold notifications: + +1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account. +2. Go to **Notifications** > **Add**. +3. Select **Magic Transit** from the product dropdown menu. +4. Find the **Magic Network Monitoring: Volumetric Attack** alert, and select **Select**. +5. Fill in the notification configuration details. +6. Select **Save**. + +## Configure dynamic threshold notifications + +To configure dynamic threshold notifications: + +1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account. +2. Go to **Notifications** > **Add**. +3. Select **Magic Transit** from the product dropdown menu. +4. Find the **Magic Network Monitoring: Volumetric Attack** alert, and select **Select**. +5. Fill in the notification configuration details. +6. Select **Save**. + +## Configure sFlow DDoS attack notifications + +To configure sFlow DDoS attack notifications: + +1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account. +2. Go to **Notifications** > **Add**. +3. Select **Magic Transit** from the product dropdown menu. +4. Find the **Magic Network Monitoring: DDoS Attack** alert, and select **Select**. +5. Fill in the notification configuration details. +6. Select **Save**. \ No newline at end of file diff --git a/src/content/docs/magic-network-monitoring/rules/s-flow-ddos-attack.mdx b/src/content/docs/magic-network-monitoring/rules/s-flow-ddos-attack.mdx new file mode 100644 index 000000000000000..686dfe4fb9e8de7 --- /dev/null +++ b/src/content/docs/magic-network-monitoring/rules/s-flow-ddos-attack.mdx @@ -0,0 +1,36 @@ +--- +title: sFlow DDoS attack rule +pcx_content_type: how-to +sidebar: + order: 3 + badge: + text: Beta +--- + +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. Magic Network Monitoring uses the same DDoS attack detection rules that protect Cloudflare's global network to generate these alerts for customers. + +Only customers that send sFlow data to Cloudflare can configure a sFlow DDoS attack rule. + +An sFlow DDoS attack rule can only be configured via Cloudflare's API. Today, customers are unable to configure a sFlow DDoS attack rule in the Cloudflare dashboard. + +## Send sFlow data from your network to Cloudflare + +Customers can export sFlow data of their network traffic to Cloudflare via Magic Network Monitoring. There are [specific brands and models](/magic-network-monitoring/routers/supported-routers/) of routers that are capable of generating sFlow data. Make sure to check the router specifications to ensure that it is able to export sFlow data. Customers can follow this [sFlow configuration guide](/magic-network-monitoring/routers/sflow-config/) to configure sFlow exports to Magic Network Monitoring. + +## Rule configuration fields + +| Field | Description | +| :---- | :---- | +| **Rule name** | Must be unique and cannot contain spaces. Supports characters `A-Z`, `a-z`, `0-9`, underscore (`_`), dash (`-`), period (`.`), and tilde (`~`). Maximum of 256 characters. | +| **Rule type** | advanced_ddos | +| **Prefix Match** | The field `prefix_match` determines how IP matches are handled. | +| **Auto-advertisement** | If you are a [Magic Transit On Demand](/magic-transit/on-demand) customer, you can enable this feature to automatically enable Magic Transit if the rule's dynamic threshold is triggered. To learn more and see an example, view the [Auto-Advertisement section](/api/resources/magic_network_monitoring/subresources/rules/). | +| **Rule IP prefix** | The IP prefix associated with the rule for monitoring traffic volume. Must be a CIDR range such as `160.168.0.1/24`. The maximum is 5,000 unique CIDR entries. To learn more and see an example, view the [Rule IP prefixes](/magic-network-monitoring/rules/#rule-ip-prefixes). | + +## API documentation + +You can visit [developers.cloudflare.com/api/](/api/), navigate to [Magic Network Monitoring](/api/resources/magic_network_monitoring/), and expand the [Rules](/api/resources/magic_network_monitoring/subresources/rules/) section to see an example API configuration call using CURL and the expected output for a successful response. + +## Tune the sFlow DDoS alert thresholds + +Customers can tune the thresholds of their sFlow DDoS alerts in the dashboard and via the Cloudflare API by following the [Network-layer DDoS Attack Protection managed ruleset](/ddos-protection/managed-rulesets/network/) guide. \ No newline at end of file diff --git a/src/content/docs/magic-network-monitoring/rules/sflow-ddos-alerts.mdx b/src/content/docs/magic-network-monitoring/rules/sflow-ddos-alerts.mdx deleted file mode 100644 index fbbb98f16153512..000000000000000 --- a/src/content/docs/magic-network-monitoring/rules/sflow-ddos-alerts.mdx +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: sFlow DDoS alerts -pcx_content_type: how-to -sidebar: - order: 2 - ---- - -import { GlossaryTooltip } from "~/components" - -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. Cloudflare uses the same DDoS attack detection rules that protect our own global network to generate these alerts for customers. - -## Send sFlow data from your network to Cloudflare - -Customers can export sFlow data of their network traffic to Cloudflare via Magic Network Monitoring. There are [specific brands and models](/magic-network-monitoring/routers/supported-routers/) of routers that are capable of generating sFlow data. Make sure to check the router specifications to ensure that it is able to export sFlow data. Customers can follow this [sFlow configuration guide](/magic-network-monitoring/routers/sflow-config/) to configure sFlow exports to Magic Network Monitoring. - -## Use sFlow DDoS alerts - -Customers can configure sFlow DDoS alerts and receive notifications if a DDoS attack is detected within their sFlow traffic. These alerts are not compatible with NetFlow traffic. The sFlow DDoS alerts can be used along with traffic volume threshold alerts to give customers multiple layers of DDoS protection. - -## Configure the sFlow DDoS alerts - -To configure sFlow DDoS alerts: - -1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account. -2. Go to **Notifications**, and select **Add**. -3. Select **Magic Transit** from the product dropdown menu. -4. Find the **Magic Network Monitoring: DDoS Attack** alert, and select **Select**. -5. Fill in the notification configuration details. -6. Select **Save**. - -## Tune the sFlow DDoS alert thresholds - -Customers can tune the thresholds of their sFlow DDoS alerts in the dashboard and via the Cloudflare API by following the [Network-layer DDoS Attack Protection managed ruleset](/ddos-protection/managed-rulesets/network/) guide. diff --git a/src/content/docs/magic-network-monitoring/rules/recommended-rule-configuration.mdx b/src/content/docs/magic-network-monitoring/rules/static-threshold.mdx similarity index 52% rename from src/content/docs/magic-network-monitoring/rules/recommended-rule-configuration.mdx rename to src/content/docs/magic-network-monitoring/rules/static-threshold.mdx index 4fa704ff1735393..b42ca48e0553ef5 100644 --- a/src/content/docs/magic-network-monitoring/rules/recommended-rule-configuration.mdx +++ b/src/content/docs/magic-network-monitoring/rules/static-threshold.mdx @@ -1,39 +1,58 @@ --- -title: Recommended rule configuration +title: Static threshold rule pcx_content_type: how-to sidebar: order: 1 - --- -import { GlossaryTooltip } from "~/components" +A static threshold rule allows you to define a constant numeric threshold, in terms of bits or packets, for DDoS traffic monitoring. The total traffic across all IP prefixes and IP addresses in the rule is compared to the static rule threshold. If the total traffic exceeds the static rule threshold for the duration of the rule, then an alert is sent. + +Customers that send NetFlow and / or sFlow data to Cloudflare can configure static threshold rules. + +## Rule configuration fields + +| Field | Description | +| :---- | :---- | +| **Rule name** | Must be unique and cannot contain spaces. Supports characters `A-Z`, `a-z`, `0-9`, underscore (`_`), dash (`-`), period (`.`), and tilde (`~`). Maximum of 256 characters. | +| **Rule type** | threshold | +| **Rule threshold type** | Can be defined in either bits per second or packets per second. | +| **Rule threshold** | The number of bits per second or packets per second for the rule alert. When this value is exceeded for the rule duration, an alert notification is sent. Minimum of `1` and no maximum. | +| **Rule duration** | The amount of time in minutes the rule threshold must exceed to send an alert notification. Choose from the following values: `1`, `5`, `10`, `15`, `20`, `30`, `45`, or `60` minutes. | +| **Auto-advertisement** | If you are a [Magic Transit On Demand](/magic-transit/on-demand) customer, you can enable this feature to automatically enable Magic Transit if the rule alert is triggered. To learn more and see an example, view the [Auto-Advertisement section](/magic-network-monitoring/rules/rule-notifications/#rule-auto-advertisement-notifications). | +| **Rule IP prefix** | The IP prefix associated with the rule for monitoring traffic volume. Must be a CIDR range such as `160.168.0.1/24`. Max is 5,000 unique CIDR entries. To learn more and see an example, view the [Rule IP prefixes](/magic-network-monitoring/rules/#rule-ip-prefixes) section. | + +## API documentation + +You can visit developers.cloudflare.com/api, navigate to Magic Network Monitoring, and expand the [Magic Network Monitoring Rules](/api/resources/magic_network_monitoring/subresources/rules/) section to see an example CURL API configuration call that will create a new rule. The API documentation also includes an example of a successful response. + +## Recommended rule configuration -You can create [Magic Network Monitoring rules](/magic-network-monitoring/rules/) to monitor the traffic volume of your network, for a set of IP addresses and/or IP prefixes. The traffic volume threshold for these rules is also set by you. If the traffic volume threshold is crossed, Magic Network Monitoring will send an alert via email, webhook, or PagerDuty. +You can create [Magic Network Monitoring rules](/magic-network-monitoring/rules/) to monitor the traffic volume of your network for a set of IP prefixes and / or IP addresses. The traffic volume threshold for these rules is also set by you. If the traffic volume threshold is crossed, Magic Network Monitoring will send an alert via email, webhook, or PagerDuty. Follow the guidelines outlined in this page to create appropriate Magic Network Monitoring rules and set accurate rule thresholds. -## Rule IP prefixes +### Rule IP prefixes Cloudflare recommends that customers start by creating one Magic Network Monitoring rule for each public `/24` IP prefix within their network. It is helpful to include the range of the `/24` IP prefix to make it easier to find and filter for the rule in Magic Network Monitoring analytics. As you become more familiar with the traffic patterns across each IP prefix, we encourage you to create more complex rules with IP prefixes that are smaller or larger than a `/24` prefix depending on your needs. You can also combine and monitor multiple IP prefixes within the same rule. -## Rule threshold +### Rule threshold Follow the steps below to configure appropriate rule thresholds. -### Initial rule configuration +#### Initial rule configuration When you initially configure Magic Network Monitoring, you may not know the typical traffic volume patterns across each of your IP prefixes. Cloudflare recommends that you set a high rule threshold of either 10 Gbps (gigabits per second) or 10 Mpps (million packets per second) that is unlikely to be crossed during initial configuration. This will allow you to collect initial information about the typical traffic volume for a Magic Network Monitoring rule without receiving any alerts. After you have collected and analyzed the historical traffic data for an Magic Network Monitoring rule, the threshold should be adjusted to an appropriate value. | Threshold type | Recommended rule threshold to collect initial data | -| -------------- | -------------------------------------------------- | -| Bits | 10 Gpbs (10,000,000,000 bits per second) | -| Packets | 10 Mpps (10,000,000 packets per second) | +| :---- | :---- | +| Bits | 10 Gpbs (10,000,000,000 bits per second) | +| Packets | 10 Mpps (10,000,000 packets per second) | -### Setting the appropriate threshold +#### Setting the appropriate threshold After creating the initial set of rules to monitor your network traffic, you should collect 14-30 days of historical traffic volume data for each rule. @@ -45,22 +64,21 @@ To find the maximum non-attack traffic for a one minute time interval over the p 2. Go to **Analytics & Logs** > **Magic Monitoring**. 3. Select **Add filter**. 4. In **New filter**, use the drop-down menus to create the following filter: - | Field | Operator | Rule name | - | ----------------- | -------- | ------------- | - | _Monitoring Rule_ | _equals_ | `` | -Once the rule filter is selected in Magic Network Monitoring Analytics, you can check the historical traffic volume data for the rule over the selected time period. We recommend that you check your historical traffic volume data in increments of seven days since that is the largest window that shows one hour time intervals. You can select a custom seven day time range in Magic Network Monitoring Analytics by going to the top right corner of Magic Network Monitoring analytics, opening the time window dropdown, and selecting **Custom range**. +| Field | Operator | Rule name | +| :---- | :---- | :---- | +| _Monitoring Rule_ | _equals_ | `` | -![How to choose a custom time range.](~/assets/images/magic-network-monitoring/custom-time-range.png) +Once the rule filter is selected in Magic Network Monitoring Analytics, you can check the historical traffic volume data for the rule over the selected time period. We recommend that you check your historical traffic volume data in increments of seven days since that is the largest window that shows one hour time intervals. You can select a custom seven-day time range in Magic Network Monitoring Analytics by going to the top right corner of Magic Network Monitoring analytics, opening the time window dropdown, and selecting **Custom range**. -You should review the selected seven day time range and identify the largest traffic volume peak. Then, click and drag on the largest traffic peak to view the traffic volume data for a smaller time window. Continue until you are viewing the traffic volume data in one minute time intervals. +You should review the selected seven-day time range and identify the largest traffic volume peak. Then, click and drag on the largest traffic peak to view the traffic volume data for a smaller time window. Continue until you are viewing the traffic volume data in one-minute intervals. Record the largest traffic volume peak for the rule in a spreadsheet, then repeat this process across 14-30 days of data. The rule threshold should be updated to be two times the largest traffic spike for a one minute time interval across 14-30 days of data. You should go through this process to set the threshold for each Magic Network Monitoring rule. -## Rule duration +### Rule duration -Your IP prefixes may experience inconsistent spikes in traffic volume across one minute time intervals. We recommend that you set a rule duration of 120 seconds to reduce false positive alerts on short-term non-malicious traffic spikes. A rule duration of 120 seconds means that the traffic volume must be above the rule threshold for 120 seconds before an alert is fired. +Your IP prefixes may experience inconsistent spikes in traffic volume across one minute time intervals. We recommend that you set a rule duration of 120 seconds or greater to reduce false positive alerts on short-term non-malicious traffic spikes. A rule duration of 120 seconds means that the traffic volume must be above the rule threshold for 120 seconds before an alert is fired. -## Adjusting rules over time +### Adjusting rules over time -After you update your first set of rule thresholds based on historical traffic data, it will be important to monitor for Magic Network Monitoring alerts to check if the rule thresholds are appropriate. Customers are encouraged to adjust the rule thresholds and the duration over time to find the ideal alert sensitivity level for their specific network environment. +After you update your first set of rule thresholds based on historical traffic data, it will be important to monitor for Magic Network Monitoring alerts to check if the rule thresholds are appropriate. Customers are encouraged to adjust the rule thresholds and the duration over time to find the ideal alert sensitivity level for their specific network environment. \ No newline at end of file