All Products
Search
Document Center

Cloud Config:Examples of resource change logs

Last Updated:Sep 06, 2023

This topic provides examples of resource change logs that are delivered to Simple Log Service for storage. The following sections describe the content of the examples and the parameters included in the logs.

Examples

The following three pieces of code show sample resource change logs for the create, modify, and delete operations on resources:

  • Create a resource

    In single-account mode, you use an Alibaba Cloud account whose ID is 110803419679**** to create a disk named test_disk in Elastic Compute Service (ECS) in the China (Hohhot) region. In the following sample log, the configurationDiff parameter displays the disk configurations before and after the create operation. The disk configuration before the create operation is displayed as null. The relationship and relationshipDiff parameters show that a resource whose ID is i-8psdh7l6lphbn10l**** is associated with the disk.

    accountId:110803419679****
    availabilityZone:cn-huhehaote-a
    captureTime:1642411308000
    configuration:{"DetachedTime":"","Category":"cloud_efficiency","KMSKeyId":"","Description":"","ResourceGroupId":"rg-aekzmdckngg****","Size":40,"Encrypted":false,"DeleteAutoSnapshot":false,"DiskChargeType":"PrePaid","Attachments":{"Attachment":[{"AttachedTime":"2022-01-17T09:20:14Z","InstanceId":"i-8psdh7l6lphbn10l****","Device":"/dev/xvda"}]},"MultiAttach":"Disabled","ExpiredTime":"2022-02-17T16:00Z","ImageId":"win2012r2_9600_x64_dtc_en-us_40G_alibase_20211217.vhd","StorageSetId":"","Tags":{"Tag":[]},"Status":"In_use","AttachedTime":"2022-01-17T09:20:14Z","StorageClusterId":"","ZoneId":"cn-huhehaote-a","InstanceId":"i-8psdh7l6lphbn10l****","ProductCode":"","SourceSnapshotId":"","Device":"/dev/xvda","PerformanceLevel":"","DeleteWithInstance":true,"EnableAutomatedSnapshotPolicy":false,"EnableAutoSnapshot":true,"AutoSnapshotPolicyId":"","DiskName":"","test_disk":"","OperationLocks":{"OperationLock":[]},"Portable":true,"Type":"system","SerialNumber":"8psdh7l6lphbn10i****","CreationTime":"2022-01-17T09:20:10Z","RegionId":"cn-huhehaote","DiskId":"d-8psdh7l6lphbn10i****"}
    configurationDiff:{"Category":[null,"cloud_efficiency"],"ResourceGroupId":[null,"rg-aekzmdckngg****"],"Size":[null,40],"Encrypted":[null,false],"DeleteAutoSnapshot":[null,false],"DiskChargeType":[null,"PrePaid"],"Attachments":[null,{"Attachment":[{"AttachedTime":"2022-01-17T09:20:14Z","InstanceId":"i-8psdh7l6lphbn10l****","Device":"/dev/xvda"}]}],"MultiAttach":[null,"Disabled"],"ExpiredTime":[null,"2022-02-17T16:00Z"],"ImageId":[null,"win2012r2_9600_x64_dtc_en-us_40G_alibase_20211217.vhd"],"Tags":[null,{"Tag":[]}],"Status":[null,"In_use"],"AttachedTime":[null,"2022-01-17T09:20:14Z"],"ZoneId":[null,"cn-huhehaote-a"],"InstanceId":[null,"i-8psdh7l6lphbn10l****"],"Device":[null,"/dev/xvda"],"DeleteWithInstance":[null,true],"EnableAutomatedSnapshotPolicy":[null,false],"EnableAutoSnapshot":[null,true],"OperationLocks":[null,{"OperationLock":[]}],"Portable":[null,true],"Type":[null,"system"],"SerialNumber":[null,"8psdh7l6lphbn10i****"],"CreationTime":[null,"2022-01-17T09:20:10Z"],"RegionId":[null,"cn-huhehaote"],"DiskId":[null,"d-8psdh7l6lphbn10i****"]}
    dataType:ConfigurationItemChangeNotification
    regionId:cn-huhehaote
    relationship:[{"regionId":"cn-huhehaote","relationType":"IsAttachedTo","resourceId":"i-8psdh7l6lphbn10l****","resourceType":"ACS::ECS::Instance"}]
    relationshipDiff:{"relationship_diff":{"relationship_add":[{"regionId":"cn-huhehaote","relationType":"IsAttachedTo","resourceId":"i-8psdh7l6lphbn10l****","resourceType":"ACS::ECS::Instance"}],"relationship_delete":[]}}
    requestId:be30368b-71dd-4367-9871-d00e565f8679
    resourceCreateTime:1642411210000
    resourceEventType:DISCOVERED
    resourceGroupId:rg-aekzmdckngg****
    resourceId:d-8psdh7l6lphbn10i****
    resourceName:test_disk
    resourceStatus:In_use
    resourceType:ACS::ECS::Disk
    tags:{}
  • Modify a resource

    In single-account mode, you use an Alibaba Cloud account whose ID is 118239008140**** to add the key1 tag to a disk named test_disk in ECS in the China (Hohhot) region. In the following sample log, the configurationDiff parameter displays the tag configurations of the disk before and after the modify operation. The tag configuration of the disk is displayed as null before the modify operation. A tag whose key is key1 is displayed in the tag configuration of the disk after the modify operation. The relationship and relationshipDiff parameters show that a resource whose ID is i-bp1g9rukkdar0dro**** is disassociated from the disk.

    accountId:118239008140****
    availabilityZone:cn-hangzhou-i
    captureTime:1630422042000
    configuration:{"DetachedTime":"2022-01-17T09:27:40Z","Category":"cloud_efficiency","KMSKeyId":"","Description":"","ResourceGroupId":"","Size":20,"Encrypted":false,"DeleteAutoSnapshot":true,"DiskChargeType":"PostPaid","MultiAttach":"Disabled","ExpiredTime":"2999-09-08T16:00Z","ImageId":"","StorageSetId":"","Tags":{"Tag":[{"TagKey":"key1","TagValue":""}]},"Status":"Available","AttachedTime":"2022-01-17T09:02:01Z","StorageClusterId":"","ZoneId":"cn-hangzhou-i","InstanceId":"","ProductCode":"","SourceSnapshotId":"","Device":"","PerformanceLevel":"","DeleteWithInstance":false,"EnableAutomatedSnapshotPolicy":false,"EnableAutoSnapshot":true,"AutoSnapshotPolicyId":"","DiskName":"test_disk","BdfId":"","OperationLocks":{"OperationLock":[]},"Portable":true,"Type":"data","SerialNumber":"bp1fybs4hwesp8kv****","CreationTime":"2021-08-19T09:11:48Z","RegionId":"cn-hangzhou","DiskId":"d-bp1fybs4hwesp8kv****"}
    configurationDiff:{"Tags":[{"Tag":[]},{"Tag":[{"TagKey":"key1","TagValue":""}]}]}
    dataType:ConfigurationItemChangeNotification
    regionId:cn-hangzhou
    relationship:
    relationshipDiff:{"relationship_diff":{"relationship_add":[],"relationship_delete":[{"regionId":"cn-hangzhou","relationType":"IsAttachedTo","resourceId":"i-bp1g9rukkdar0dro****","resourceType":"ACS::ECS::Instance"}]}}
    requestId:4f9a90a9-63bf-43bd-981d-bc15658c423e
    resourceCreateTime:1630422000000
    resourceEventType:MODIFY
    resourceGroupId:rg-acfmwvtff2y***
    resourceId:d-bp1fybs4hwesp8kv****
    resourceName:test_disk
    resourceStatus:Available
    resourceType:ACS::ECS::Disk
    tags:{"key1":[""]}
  • Delete a resource

    In single-account mode, you use an Alibaba Cloud account whose ID is 120886317861**** to delete a disk named test_disk from ECS in the China (Hohhot) region. In the following sample log, the configurationDiff parameter displays the disk configurations before and after the delete operation. The disk configuration after the delete operation is displayed as null. The relationship and relationshipDiff parameters show that the disk has no associated resources.

    accountId:120886317861****
    availabilityZone:cn-huhehaote-a
    captureTime:1629875147000
    configuration:{"DetachedTime":"","Category":"cloud_essd","KMSKeyId":"","Description":"","ResourceGroupId":"","Size":40,"Encrypted":false,"DeleteAutoSnapshot":false,"DiskChargeType":"PostPaid","MultiAttach":"Disabled","ExpiredTime":"2999-09-08T16:00Z","ImageId":"","StorageSetId":"","Tags":{"Tag":[]},"Status":"Available","AttachedTime":"","StorageClusterId":"","ZoneId":"cn-huhehaote-a","InstanceId":"","ProductCode":"","SourceSnapshotId":"","Device":"","PerformanceLevel":"PL1","DeleteWithInstance":false,"EnableAutomatedSnapshotPolicy":false,"EnableAutoSnapshot":true,"AutoSnapshotPolicyId":"","DiskName":"test_disk","BdfId":"","OperationLocks":{"OperationLock":[]},"Portable":true,"Type":"data","SerialNumber":"hp33mwzuof9qoa22****","CreationTime":"2021-08-25T06:52:35Z","RegionId":"cn-huhehaote","DiskId":"d-hp33mwzuof9qoa22****"}
    configurationDiff:{"Status":["Available",null],"Category":["cloud_essd",null],"ZoneId":["cn-huhehaote-a",null],"Size":[40,null],"Encrypted":[false,null],"PerformanceLevel":["PL1",null],"DeleteAutoSnapshot":[false,null],"DeleteWithInstance":[false,null],"EnableAutomatedSnapshotPolicy":[false,null],"DiskChargeType":["PostPaid",null],"EnableAutoSnapshot":[true,null],"DiskName":["test_disk",null],"MultiAttach":["Disabled",null],"OperationLocks":[{"OperationLock":[]},null],"Portable":[true,null],"Type":["data",null],"SerialNumber":["hp33mwzuof9qoa22ic6q",null],"ExpiredTime":["2999-09-08T16:00Z",null],"CreationTime":["2021-08-25T06:52:35Z",null],"RegionId":["cn-huhehaote",null],"Tags":[{"Tag":[]},null],"DiskId":["d-hp33mwzuof9qoa22****",null]}
    dataType:ConfigurationItemChangeNotification
    regionId:cn-huhehaote
    relationship:
    relationshipDiff:{"relationship_diff":{"relationship_add":[],"relationship_delete":[]}}
    requestId:d9bca2bc-75ba-4e4c-92dd-7cc38e779806
    resourceCreateTime:1629874355000
    resourceEventType:REMOVE
    resourceGroupId:rg-acfmw3ty5y7****
    resourceId:d-hp33mwzuof9qoa22****
    resourceName:test_disk
    resourceStatus:Available
    resourceType:ACS::ECS::Disk
    tags:{}

Parameters

The following table describes the parameters included in resource change logs that are delivered to Simple Log Service.

Parameter

Description

accountId

The ID of the account to which the resource belongs. The account ID depends on the account mode.

  • Single-account mode: Enter the ID of an independent Alibaba Cloud account that is not added to a resource directory by using a management account.

  • Multi-account mode: Enter a management account ID or a member account ID.

availabilityZone

The ID of the zone where the resource resides.

captureTime

The timestamp when Cloud Config detected the resource change and generated the log.

configuration

The current configuration of the resource.

configurationDiff

The resource configurations before and after the change.

dataType

The type of the log received by Simple Log Service. Valid values:

  • ConfigurationItemChangeNotification: resource change log

  • NonCompliantNotification: resource non-compliance event

regionId

The ID of the region where the resource resides.

relationship

The details of each resource that is associated with the current resource, including the region ID, resource relationship, resource ID, and resource type. This parameter is available only if the current resource has associated resources.

  • If the current resource has associated resources, the value indicates the details of each associated resource.

    For information about the Alibaba Cloud services and resource types supported by Cloud Config, see Alibaba Cloud services and resource types supported by Cloud Config.

  • If the current resource has no associated resources, the parameter is left empty.

relationshipDiff

The change records of the resource relationship.

resourceCreateTime

The timestamp when the resource was created.

resourceEventType

The type of the resource change event. Valid values:

  • DISCOVERED: A resource is created.

  • MODIFY: A resource is modified.

  • REMOVE: A resource is deleted.

resourceGroupId

The ID of the resource group to which the resource belongs. This parameter is available only if the resource type supports resource groups.

  • If the resource type supports resource groups, the value is the ID of the resource group to which the resource belongs.

    For more information about the Alibaba Cloud services and resource types that support resource groups, see Services that work with Resource Group.

  • If the resource type does not support resource groups, the parameter is left empty.

resourceId

The resource ID.

resourceName

The resource name.

resourceStatus

The status of the resource. The value of the parameter varies based on the resource type and the parameter may be left empty. Examples:

  • If the value of the resourceType parameter is ACS::ECS::Instance, the resource is an ECS instance that is in a specific state. In this case, valid values of this parameter are Running and Stopped.

  • If the value of the ResourceType parameter is ACS::OSS::Bucket, the resource is an Object Storage Service (OSS) bucket that is not in a specific state. In this case, this parameter is left empty.

resourceType

The resource type. For more information about the resource types supported by Cloud Config, see Alibaba Cloud services and resource types supported by Cloud Config.

tags

The tags of the resource.