All Products
Search
Document Center

Simple Log Service:GetCollectionPolicy

Last Updated:Sep 18, 2025

You can call the GetCollectionPolicy operation to retrieve the details of a specific rule.

Operation description

The endpoint for this operation is available only in the China (Shanghai), Singapore, and China (Heyuan) Automotive Compliance Cloud (cn-heyuan-acdr-1) regions.

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/{policyName} HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

policyName

string

Yes

The name of the rule.

your_log_policy

productCode

string

No

The code of the product.

oss

dataCode

string

No

The code for the log type.

access_log

Response elements

Element

Type

Description

Example

headers

object

Content-Length

string

Content-Type

string

x-log-requestid

string

Server

string

Date

string

Connection

string

object

The response body.

collectionPolicy

object

The details of the rule.

policyName

string

The name of the rule.

your_log_policy

enabled

boolean

Indicates whether the rule is enabled.

true

productCode

string

The code of the product.

oss

dataCode

string

The code for the log type.

access_log

policyConfig

object

The configuration of the collection rule.

resourceMode

string

The collection pattern for resources.

all

regions

array

The regions where the instances reside. Wildcard characters are supported.

string

The region ID.

cn-hangzhou

instanceIds

array

The instance IDs.

string

The instance ID.

your-test-bucket1

resourceTags

object

The resource tags.

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

centralizeEnabled

boolean

Indicates whether centralized storage is enabled.

false

centralizeConfig

object

The configuration for centralized shipping.

destRegion

string

The destination region for centralized shipping.

cn-beijing

destProject

string

The destination project for centralized shipping.

your-sls-project-in-beijing

destLogstore

string

The destination Logstore for centralized shipping.

your-sls-logstore-in-beijing

destTTL

integer

The retention period of the destination Logstore. Unit: days.

0

resourceDirectory

object

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

accountGroupType

string

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

all,custom

members

array

The member accounts. This parameter is returned only when `accountGroupType` is set to `custom`.

string

The ID of the Alibaba Cloud account.

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

dataConfig

object

The configuration that is supported only for global log types, such as when `productCode` is `sls`. Otherwise, this parameter is empty.

dataRegion

string

This parameter is supported only for global log types, such as when `productCode` is `sls`. This parameter specifies the region to which global logs are collected during the initial configuration.

cn-beijing

dataProject

string

This parameter is valid only for global log types, such as when `productCode` is `sls`. If this parameter is left empty, logs are collected to the default project of the account in the specified `dataRegion`.

""

internalPolicy

boolean

Indicates whether the rule is a built-in rule. Built-in rules cannot be modified or deleted.

false

policyUid

string

The ID of the Alibaba Cloud account to which the rule belongs. If the rule is created by a resource directory administrator or a delegated administrator, this parameter specifies the ID of the administrator's Alibaba Cloud account.

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

Examples

Success response

JSON format

{
  "collectionPolicy": {
    "policyName": "your_log_policy",
    "enabled": true,
    "productCode": "oss",
    "dataCode": "access_log",
    "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-beijing",
      "dataProject": "\"\""
    },
    "internalPolicy": false,
    "policyUid": "148***********50\n"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.