All Products
Search
Document Center

Security Center:CreateDetectionRule

Last Updated:Dec 08, 2025

Creates a detection rule.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

yundun-sas:CreateDetectionRule

create

*DetectionRule

acs:yundun-sas::{#accountId}:detection/*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

No

The region where the Data Management center of Threat Analysis is located. Select a region based on the region where your assets are located. Valid values:

  • cn-hangzhou: Your assets are in the Chinese mainland.

  • ap-southeast-1: Your assets are in a region outside China.

cn-hangzhou

Lang

string

No

The language of the response. Valid values:

  • zh (default): Chinese.

  • en: English.

zh

DetectionRuleName

string

Yes

The name of the detection rule.

dr-ha1i09ob3zmqrs85****

DetectionRuleDescription

string

No

The description of the detection rule.

dr-123

DetectionRuleType

string

Yes

The type of the detection rule. Valid values:

  • preset: predefined detection rule.

  • custom: custom detection rule.

  • custom_template: rule template.

custom

DetectionRuleStatus

string

No

The status of the detection rule.

0

AlertType

string

Yes

The alert type.

WebShell

AlertLevel

string

Yes

The threat level of the alert. Valid values:

  • 5: critical.

  • 4: important.

  • 3: medium.

  • 2: low.

  • 1: informational.

1

AlertTacticId

string

No

The tactic phase of the alert.

TA0042

AlertAttCk

string

No

The ATT&CK stage of the alert.

Discovery

DetectionExpressionType

string

No

The type of the detection rule expression. Valid values:

  • sql: SQL.

  • playbook: playbook.

Valid values:

  • sql :

    sql

  • playbook :

    playbook

sql

DetectionExpressionContent

string

No

The content of the detection rule expression.

*|set session mode=scan;SELECT * FROM log WHERE schema = 'PROCESS_START_ACTIVITY' AND ( proc_path LIKE '%/groups' OR ( ( proc_path LIKE '%/cat' OR proc_path LIKE '%/head' OR proc_path LIKE '%/tail' OR proc_path LIKE '%/more' ) AND cmdline LIKE '%/etc/group%' ) )

LogCategoryId

string

No

The ID of the log normalization category.

NETWORK_CATEGORY

LogSchemaId

string

Yes

The ID of the log normalization schema.

API_RISK_ACTIVITY

AlertSchemaId

string

Yes

The ID of the alert template for the detection rule. Valid values:

  • ALERT_ACTIVITY: other alerts.

  • EDR_ALERT_ACTIVITY: Endpoint Detection and Response (EDR) alerts.

  • FIREWALL_ALERT_ACTIVITY: firewall alerts.

  • WAF_ALERT_ACTIVITY: Web Application Firewall (WAF) alerts.

ALERT_ACTIVITY

ScheduleType

string

No

The scheduling type. Valid values:

  • fixed_rate: fixed interval.

  • cron: cron expression.

fixed_rate

ScheduleExpression

string

No

The cron expression for scheduling. This parameter is required if you set ScheduleType to cron.

0/5 * * * *

ScheduleMaxRetries

integer

No

The maximum number of retries after a timeout. Valid values: 1 to 100.

1

ScheduleBeginTime

integer

No

The start time for scheduling. This is a 13-digit UNIX timestamp.

1733269771123

ScheduleWindow

string

No

The length of the scheduling window.

5m

ScheduleMaxTimeout

integer

No

The maximum timeout period in seconds. Valid values: 60 to 1800.

60

AlertThresholdPeriod

string

No

The length of the alert threshold period.

5m

AlertThresholdCount

integer

No

The count for the alert threshold.

10

AlertThresholdGroup

string

No

The list of fields for the alert threshold. Separate multiple fields with commas.

alert_type,ip

IncidentAggregationType

string

No

The event aggregation type. Valid values:

  • none: Events are not generated.

  • graph_compute: graph computing (supported by predefined rules).

  • expert: expert rules.

  • passthrough: Alerts are passed through (one-to-one).

  • window: Similar alerts are aggregated (window).

window

IncidentAggregationExpression

string

No

The configuration of the event aggregation period.

5m

PlaybookUuid

string

No

The UUID of the playbook.

system_aliyun_clb_process_book

PlaybookParameters

string

No

The custom parameters for the playbook.

{ "ip": { "ip": "124.23.*.*" } }

RoleFor

integer

No

The user ID that an administrator uses to switch to the perspective of another member.

113091674488****

EntityMappings

string

No

The entity mapping configuration.

[{\"NormalizationSchemaId\":\"host\",\"NormalizationFieldMappings\":[{\"NormalizationFieldName\":\"uuid\",\"MappingFieldName\":\"host\",\"NormalizationFieldType\":\"varchar\"}]}]

DetectionRuleTemplateId

string

No

The ID of the detection rule template.

cfw-out-ip_aegis-netstat

DetectionRuleTemplateVersion

string

No

The version of the detection rule template.

v1.0.0

AlertName

string

No

The alert name. You can use $$ to reference fields from the query output.

Detected high-frequency multi-type network attacks from $src_ip$

AlertDescription

string

No

The alert description. You can use $$ to reference fields from the query output.

Alert from: $product_code$, detected network attack from $src_ip$, affected assets include: $dst_ip$

Response elements

Element

Type

Description

Example

object

The response body.

RequestId

string

The request ID.

5CC09D0C-1CD7-54BD-A853-DCB2D945****

DetectionRuleId

string

The ID of the detection rule.

dr-ha1i09ob3zmqrs85****

Examples

Success response

JSON format

{
  "RequestId": "5CC09D0C-1CD7-54BD-A853-DCB2D945****",
  "DetectionRuleId": "dr-ha1i09ob3zmqrs85****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 IdempotentParameterMismatch The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.