All Products
Search
Document Center

Simple Log Service:ListCollectionPolicies

Last Updated:Sep 18, 2025

Lists the collection rules for logs from Alibaba Cloud services.

Operation description

This API operation is available only at the endpoints in the following regions: China (Shanghai), Singapore, and Heyuan Automotive Compliance Cloud (cn-heyuan-acdr-1).

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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

GET /collectionpolicy HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

productCode

string

No

The code of the Alibaba Cloud service.

oss

dataCode

string

No

The code of the log type.

access_log

policyName

string

No

The name of the collection rule.

your_log_policy

size

integer

No

The number of collection rules to return on each page. Default value: 50. Maximum value: 100.

50

offset

integer

No

The row from which the query starts. Default value: 0.

0

instanceId

string

No

The instance ID. Specify this parameter to query rules that match a specific instance. If you use this parameter, you must also specify productCode and dataCode.

your-test-bucket1

centralProject

string

No

The destination project for centralized data shipping. Specify this parameter to query the number of rules that are configured to ship data to this project.

your-central-project1

Response elements

Element

Type

Description

Example

headers

object

Content-Type

string

Server

string

Content-Length

string

Date

string

Connection

string

x-log-requestid

string

object

The response body.

totalCount

integer

The total number of collection rules.

1

currentCount

integer

The number of collection rules returned on the current page.

1

data

array<object>

The collection rules that are returned on the current page.

object

The details of the collection rule.

productCode

string

The code of the Alibaba Cloud service.

oss

dataCode

string

The code of the log type.

access_log

policyName

string

The name of the collection rule.

your_log_policy

enabled

boolean

Indicates whether the collection rule is enabled.

true

policyConfig

object

The configuration of the collection rule.

resourceMode

string

The resource collection mode.

all

regions

array

The regions to which the instances belong.

string

The region ID.

cn-hangzhou

instanceIds

array

The IDs of the instances.

string

The instance ID.

your-test-bucket1

resourceTags

object

The resource tags.

{"tag1":"value1","tag2":"value2"}

centralizeEnabled

boolean

Indicates whether centralized data shipping is enabled.

false

centralizeConfig

object

The configuration for centralized data shipping.

destRegion

string

The destination region for centralized data shipping.

cn-beijing

destProject

string

The destination project for centralized data shipping.

your-sls-project-in-beijing

destLogstore

string

The destination Logstore for centralized data shipping.

your-sls-logstore-in-beijing

destTTL

integer

The data retention period of the destination Logstore for centralized data shipping. Unit: days.

0

resourceDirectory

object

The configuration of the resource directory. This parameter is empty if no configuration is available.

accountGroupType

string

The mode for selecting accounts in the resource directory. Valid values: all and custom.

all,custom

members

array

The list of member accounts. This parameter is returned only if accountGroupType is set to custom.

string

The ID of the Alibaba Cloud account.

165***********50

dataConfig

object

Configurations for global log types, such as sls. This parameter is empty for other log types.

dataRegion

string

The region where global logs are first collected. This parameter is used only for global log types, such as sls.

cn-hangzhou

dataProject

string

The project for global logs. This parameter is used only for global log types, such as sls. If this parameter is empty, logs are collected to the default project of the account in the region specified by dataRegion.

""

internalPolicy

boolean

Indicates whether the policy is a built-in policy. Built-in policies cannot be modified or deleted.

false

policyUid

string

The ID of the Alibaba Cloud account that owns the collection rule. If a resource directory administrator or delegated administrator creates the rule, this is the ID of that administrator's account.

148***********50

statistics

array<object>

Statistics returned based on the query conditions.

object

Statistics for collection rules, grouped by productCode.

productCode

string

The code of the Alibaba Cloud service.

oss

policySourceList

array<object>

The list of collection rule sources.

object

The source of the collection rule.

policyUid

string

The ID of the Alibaba Cloud account that owns the collection rule. If a resource directory administrator or delegated administrator creates the rule, this is the ID of that administrator's account.

148***********50

policyName

string

The name of the collection rule.

policy_name1_from148

Examples

Success response

JSON format

{
  "totalCount": 1,
  "currentCount": 1,
  "data": [
    {
      "productCode": "oss",
      "dataCode": "access_log",
      "policyName": "your_log_policy",
      "enabled": true,
      "policyConfig": {
        "resourceMode": "all",
        "regions": [
          "cn-hangzhou"
        ],
        "instanceIds": [
          "your-test-bucket1\n"
        ],
        "resourceTags": {
          "tag1": "value1",
          "tag2": "value2"
        }
      },
      "centralizeEnabled": false,
      "centralizeConfig": {
        "destRegion": "cn-beijing\n",
        "destProject": "your-sls-project-in-beijing\n",
        "destLogstore": "your-sls-logstore-in-beijing\n",
        "destTTL": 0
      },
      "resourceDirectory": {
        "accountGroupType": "all,custom",
        "members": [
          "165***********50"
        ]
      },
      "dataConfig": {
        "dataRegion": "cn-hangzhou",
        "dataProject": "\"\""
      },
      "internalPolicy": false,
      "policyUid": "148***********50"
    }
  ],
  "statistics": [
    {
      "productCode": "oss",
      "policySourceList": [
        {
          "policyUid": "148***********50",
          "policyName": "policy_name1_from148"
        }
      ]
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.