Queries the top N statistics of attack traffic, which is aggregated by a specified dimension, sorted, and returned.
Operation description
Attack traffic refers to requests that have rule hits and are identified as risky. The following three types of data are excluded:
Requests that hit whitelist rules.
Requests that hit bot rules but whose rule action is set to "back-to-origin marking".
Requests that hit rules with actions set to "dynamic token", "slider", "strict slider", or "JS authenticate", but the user passes the verification and the requests are allowed.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
yundun-waf:DescribeSecurityEventTopNMetric |
get |
*All Resource
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The ID of the WAF instance. Note
You can call DescribeInstance to query the ID of the current WAF instance. |
waf_cdnsdf3**** |
| Filter |
object |
Yes |
The query filter conditions. Multiple filter conditions are evaluated using a logical AND. |
|
| DateRange |
object |
Yes |
The query time range. |
|
| StartDate |
integer |
Yes |
The query data range cannot exceed the past 30 days. The start time used for querying data, expressed as a UNIX timestamp. Unit: seconds. Note
The start time must be later than the current time minus 30 days. |
1713888000 |
| EndDate |
integer |
Yes |
The end time used for querying data, expressed as a UNIX timestamp. Unit: seconds. |
1713888600 |
| Conditions |
array<object> |
No |
The list of filter conditions. Each node describes a filter condition. |
|
|
object |
No |
The configuration of a single query condition. A query condition consists of a field name, an operator, and filter values. For the supported field names and operators in query conditions, see Supplementary description of request parameters. |
||
| Key |
string |
No |
The field name on which the filter operation is performed. This operation supports all fields. |
matched_host |
| OpValue |
string |
No |
The operator. |
eq |
| Values |
any |
No |
The filter values. |
test.waf-top |
| Limit |
integer |
Yes |
The number of data entries to return after the statistics are sorted in descending order. Maximum value: 10. |
10 |
| Metric |
string |
Yes |
Specifies the type of data to return. Different Metric values correspond to different data content. The following Metric values are supported by this API operation: Note
The definition of "attack request" is described in the API operation description. The following descriptions reference this concept.
|
real_client_ip |
| RegionId |
string |
No |
The region where the WAF instance is deployed. Valid values:
|
cn-hangzhou |
| ResourceManagerResourceGroupId |
string |
No |
The Alibaba Cloud resource group ID. |
rg-acfm***q |
Operator description
| Operator | Meaning | Description |
| all-not-match | Not equal to any value | The field value is not equal to any value in the data set. For example, to filter real_client_ip not equal to any value in the set:{"Key":"real_client_ip","OpValue":"all-not-match","Values":["1.1.1.1","2.2.2.2","3.3.3.3"]} |
| contain | Contains | The field value contains a specific string. For example, to filter data where the URL contains "test":{"Key":"request_path","OpValue":"contain","Values":"test"} |
| eq | Equal to | The field value is equal to a specific string. For example, to filter data where the URL is "/testcase":{"Key":"request_path","OpValue":"eq","Values":"/testcase"} |
| match-one | Equal to one of multiple values | The field value is equal to any value in the data set. For example, to filter real_client_ip equal to any value in the set:{"Key":"real_client_ip","OpValue":"match-one","Values":["1.1.1.1","2.2.2.2","3.3.3.3"]} |
| ne | Not equal to | The field value is not equal to a specific string. For example, to filter statistics where the URL is not "/testcase":{"Key":"request_path","OpValue":"ne","Values":"/testcase"} |
| not-contain | Does not contain | The field value does not contain a specific string. For example, to filter data where the URL does not contain "test":{"Key":"request_path","OpValue":"not-contain","Values":"test"} |
| prefix-match | Prefix match | The field value starts with a specific string. For example, to filter data where the URL starts with "/testcase":{"Key":"request_path","OpValue":"prefix-match","Values":"/testcase"} |
| suffix-match | Suffix match | The field value ends with a specific string. For example, to filter data where the URL ends with "/testcase":{"Key":"request_path","OpValue":"suffix-match","Values":"/testcase"} |
Supported keys for filter conditions
| Field name | Field description | Supported operators |
| action | The protection action, which is the final action taken on the request. | ne, eq |
| cluster | The protection cluster. | ne, eq, match-one, all-not-match |
| defense_scene | The protection module. A request may match multiple protection modules. Requests filtered by this field may also match other modules. | ne, eq |
| host | The host in the HTTP header. | contain, not-contain, ne, eq, match-one, all-not-match, prefix-match, suffix-match |
| http_cookie | The cookie in the HTTP header. | contain, not-contain, ne, eq, match-one, all-not-match, prefix-match, suffix-match |
| http_user_agent | The User-Agent obtained from the HTTP header. | contain, not-contain, ne, eq, match-one, all-not-match, prefix-match, suffix-match |
| matched_host | The protected object. | ne, eq, match-one, all-not-match |
| real_client_ip | The source IP address of the request. The parameter following the operator can only be an IP address string or a list of IP address strings. CIDR block queries are not supported. | ne, eq, match-one, all-not-match |
| remote_country_id | The country to which the source IP address of the HTTP request belongs. | ne, eq, match-one, all-not-match |
| remote_region_id | The province or city to which the source IP address of the HTTP request belongs. | ne, eq, match-one, all-not-match |
| request_method | The HTTP request method. | ne, eq, match-one, all-not-match |
| request_path | The HTTP request URL, excluding the query string. | contain, not-contain, ne, eq, match-one, all-not-match, prefix-match, suffix-match |
| request_traceid | The unique ID that identifies the request. | ne, eq, match-one, all-not-match |
| rule_id | The rule ID. A request may match multiple rules. Requests filtered by this field may also match other rules. | ne, eq |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The returned data result. For format examples, see Examples. |
||
| RequestId |
string |
The request ID. |
D827FCFE-90A7-4330-9326-*****B4C7726 |
| SecurityEventTopNValues |
array<object> |
The array of top N statistics. |
|
|
object |
Each element corresponds to a top N statistics entry. |
||
| Name |
string |
The value of a specific field. The meaning varies depending on the queried Metric. |
10000 |
| Attribute |
string |
The additional information, such as the protection module to which a rule ID belongs. |
waf_base |
| Value |
integer |
The statistical count used for top N sorting. |
1111 |
| TopNMetaData |
object |
The metadata of the returned data. |
|
| DateRange |
object |
The time range used for the query. |
|
| StartDate |
integer |
The start of the time range that was queried. The value is a UNIX timestamp. Unit: seconds. This value is the same as the `StartDate` request parameter. |
1713888000 |
| EndDate |
integer |
The end of the time range that was queried. The value is a UNIX timestamp. Unit: seconds. This value is the same as the `EndDate` request parameter. |
1713888600 |
| Units |
string |
The unit of the returned statistics. |
requests |
Examples
Success response
JSON format
{
"RequestId": "D827FCFE-90A7-4330-9326-*****B4C7726\n",
"SecurityEventTopNValues": [
{
"Name": "10000",
"Attribute": "waf_base\n",
"Value": 1111
}
],
"TopNMetaData": {
"DateRange": {
"StartDate": 1713888000,
"EndDate": 1713888600
},
"Units": "requests\n"
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | Waf.Report.%s | Invalid parameter:%s. | Invalid parameter:%s |
| 400 | Waf.Report.InternalError | Server error occurred in report service. | Report Service Internal Error |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.