Queries the top N statistics for attack traffic. Attack traffic is aggregated by a specified dimension, sorted, and the top N results are returned.
Operation description
Attack traffic refers to requests that hit a rule and are identified as a threat. The following types of requests are not included in the statistics:
Requests that hit a whitelist rule.
Requests that hit a bot rule with the action set to Tag.
Requests that hit a rule with the action set to Dynamic Token, Slider, Strict Slider, or JS Challenge, and are allowed after the user passes verification.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
yundun-waf:DescribeSecurityEventTopNMetric |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The ID of the WAF instance. Note
Call the DescribeInstance operation to query the ID of the WAF instance. |
waf_cdnsdf3**** |
| Filter |
object |
Yes |
The filter conditions for the query. A logical AND operator is used between multiple filter conditions. |
|
| DateRange |
object |
Yes |
The time range to query. |
|
| StartDate |
integer |
Yes |
The start of the time range to query. The value is a UNIX timestamp. Unit: seconds. You can query data within the last 30 days. Note
The start time must be within the last 30 days. |
1713888000 |
| EndDate |
integer |
Yes |
The end of the time range to query. The value is a UNIX timestamp. Unit: seconds. |
1713888600 |
| Conditions |
array |
No |
A list of filter conditions. Each object in the array represents a filter condition. |
|
|
object |
No |
The configuration of a single query condition. A query condition consists of a field name, an operator, and a filter value. For more information about the supported field names and operators, see the Additional information about request parameters section. |
||
| Key |
string |
No |
The field to filter by. This operation supports all fields. |
matched_host |
| OpValue |
string |
No |
The operator. |
eq |
| Values |
any |
No |
The filter value. |
test.waf-top |
| Limit |
integer |
Yes |
The maximum number of entries to return. The entries are sorted in descending order. Maximum value: 10. |
10 |
| Metric |
string |
Yes |
Specifies the content of the returned data. Different metrics correspond to different data content. This operation supports the following metrics: Note
For the definition of an attack request, see the Description section of this topic. The following descriptions use this definition.
|
real_client_ip |
| RegionId |
string |
No |
The region where the WAF instance resides. Valid values:
|
cn-hangzhou |
| ResourceManagerResourceGroupId |
string |
No |
The ID of the resource group. |
rg-acfm***q |
Operator descriptions
| Operator | Meaning | Description |
| all-not-match | Not equal to any value | The field value is not equal to any value in the dataset. For example, to filter for `real_client_ip` values that are not equal to any value in a collection:{"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 for data where the URL contains "test":{"Key":"request_path","OpValue":"contain","Values":"test"} |
| eq | Equals | The field value is equal to a specific string. For example, to filter for data where the URL is "/testcase":{"Key":"request_path","OpValue":"eq","Values":"/testcase"} |
| match-one | Equals one of multiple values | The field value is equal to any value in the dataset. For example, to filter for `real_client_ip` values that are equal to any value in a collection:{"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 for 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 for 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 for data where the URL prefix is "/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 for data where the URL suffix is "/testcase":{"Key":"request_path","OpValue":"suffix-match","Values":"/testcase"} |
Supported keys for filter conditions
| Field name | Description | Supported operators |
| action | The protection action. This 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 hit multiple protection modules. Requests that are filtered by this field may also hit other modules. | ne, eq |
| host | The `host` header of the HTTP request. | contain, not-contain, ne, eq, match-one, all-not-match, prefix-match, suffix-match |
| http_cookie | The `cookie` header of the HTTP request. | contain, not-contain, ne, eq, match-one, all-not-match, prefix-match, suffix-match |
| http_user_agent | The `User-Agent` header of the HTTP request. | 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 value can be an IP address string or a list of IP address strings. CIDR blocks are not supported. | ne, eq, match-one, all-not-match |
| remote_country_id | The country of origin for the source IP address of the HTTP request. | ne, eq, match-one, all-not-match |
| remote_region_id | The province or city of origin for the source IP address of the HTTP request. | ne, eq, match-one, all-not-match |
| request_method | The HTTP request method. | ne, eq, match-one, all-not-match |
| request_path | The URL of the HTTP request, excluding the query string. | contain, not-contain, ne, eq, match-one, all-not-match, prefix-match, suffix-match |
| request_traceid | The unique ID of the request. | ne, eq, match-one, all-not-match |
| rule_id | The rule ID. A request may hit multiple rules. Requests that are filtered by this field may also hit other rules. | ne, eq |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The data returned. For a sample format, see the Examples section. |
||
| RequestId |
string |
The request ID. |
D827FCFE-90A7-4330-9326-*****B4C7726 |
| SecurityEventTopNValues |
array<object> |
An array of the top N statistics. |
|
|
object |
Each object in the array represents one top statistic. |
||
| Name |
string |
The value of a field. The meaning of this parameter varies based on the specified `Metric`. |
10000 |
| Attribute |
string |
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.