All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::OSS::BucketLogging

Last Updated:Jul 05, 2026

The ALIYUN::OSS::BucketLogging type is used to enable log dumping for a bucket.

Syntax

{
  "Type": "ALIYUN::OSS::BucketLogging",
  "Properties": {
    "Bucket": String,
    "TargetBucket": String,
    "LoggingRole": String,
    "TargetPrefix": String
  }
}

Properties

Parameter

Type

Required

Editable

Description

Constraints

Bucket

String

Yes

No

The name of the bucket for which to enable logging.

None

TargetBucket

String

Yes

Yes

The bucket that stores access logs.

None

LoggingRole

String

No

Yes

The authorization role used for bucket logging.

None

TargetPrefix

String

No

Yes

The prefix for the saved log objects.

This property can be empty.

Return values

Fn::GetAtt

  • TargetPrefix: The prefix for the saved log objects. This value can be empty.

  • LoggingRole: The authorization role used for bucket logging.

  • TargetBucket: The bucket that stores access logs.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  LoggingRole:
    Type: String
    Description:
      en: Authorization role used for bucket logging.
    Default: Null
    Required: false
  TargetPrefix:
    Type: String
    Description:
      en: The prefix for saved log objects. This can be left empty.
    Default: Null
    Required: false
  Bucket:
    Type: String
    Description:
      en: The name of the bucket.
    Required: true
  TargetBucket:
    Type: String
    Description:
      en: The bucket that stores access logs.
    Required: true
Resources:
  ExtensionResource:
    Type: ALIYUN::OSS::BucketLogging
    Properties:
      LoggingRole:
        Ref: LoggingRole
      TargetPrefix:
        Ref: TargetPrefix
      Bucket:
        Ref: Bucket
      TargetBucket:
        Ref: TargetBucket
Outputs:
  TargetPrefix:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - TargetPrefix
    Description: The prefix for saved log objects. This can be left empty.
  LoggingRole:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - LoggingRole
    Description: Authorization role used for bucket logging.
  TargetBucket:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - TargetBucket
    Description: The bucket that stores access logs.
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "LoggingRole": {
      "Type": "String",
      "Description": {
        "en": "Authorization role used for bucket logging."
      },
      "Default": null,
      "Required": false
    },
    "TargetPrefix": {
      "Type": "String",
      "Description": {
        "en": "The prefix for saved log objects. This can be left empty."
      },
      "Default": null,
      "Required": false
    },
    "Bucket": {
      "Type": "String",
      "Description": {
        "en": "The name of the bucket."
      },
      "Required": true
    },
    "TargetBucket": {
      "Type": "String",
      "Description": {
        "en": "The bucket that stores access logs."
      },
      "Required": true
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::OSS::BucketLogging",
      "Properties": {
        "LoggingRole": {
          "Ref": "LoggingRole"
        },
        "TargetPrefix": {
          "Ref": "TargetPrefix"
        },
        "Bucket": {
          "Ref": "Bucket"
        },
        "TargetBucket": {
          "Ref": "TargetBucket"
        }
      }
    }
  },
  "Outputs": {
    "TargetPrefix": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "TargetPrefix"
        ]
      },
      "Description": "The prefix for saved log objects. This can be left empty."
    },
    "LoggingRole": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "LoggingRole"
        ]
      },
      "Description": "Authorization role used for bucket logging."
    },
    "TargetBucket": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "TargetBucket"
        ]
      },
      "Description": "The bucket that stores access logs."
    }
  }
}