The Operation Content and Result Delivery feature provided by Cloud Assistant allows you to deliver O&M task execution records to Object Storage Service (OSS) or Log Service for persistent storage. This topic describes how to configure delivery settings to deliver O&M task execution records to specified OSS buckets or Log Service Logstores and how to query delivered execution records.
Background information
Cloud Assistant allows O&M task execution records to be retained but puts limits on the maximum number of execution records retained and their retention periods. For more information, see the "Cloud Assistant limits" section in Limits. If you want to retain a large number of execution records or retain execution records for an extended period of time, we recommend that you use the Operation Content and Result Delivery feature. It allows you to deliver and query O&M task execution records and perform operations on them, such as behavioral or security analysis, resource change tracking, and behavioral compliance auditing.
- Configure delivery settings. Specify a destination Log Service project and Logstore
or a destination OSS bucket.
For more information, see the Configure delivery settings in the Elastic Compute Service (ECS) console section in this topic.
- Run commands or send files. Then, the corresponding task execution records are automatically
delivered to your specified Logstore or OSS bucket.
For more information, see Immediate execution, Run a command, and Upload files to ECS instances.
- Go to the Log Service console or OSS console to query the delivered execution records.
For more information, see the Query O&M task execution records in the Log Service console and Query O&M task execution records in the OSS console sections in this topic.
Configure delivery settings in the Elastic Compute Service (ECS) console
Query O&M task execution records in the Log Service console
This section describes how to access a specified Logstore from the ECS console to query logs about delivered O&M task execution records. Alternatively, you can log on to the Log Service console and access the specified Logstore.
Query O&M task execution records in the OSS console
This section describes how to access a specified OSS bucket from the ECS console to query objects that contain delivered O&M task execution records. Alternatively, you can log on to the OSS console and access the specified bucket.
Parameters contained in O&M task execution records
Parameter | Example | Description |
---|---|---|
RegionId | cn-hangzhou | The region ID of the ECS instance on which the command was run. |
InstanceId | i-bp1hd5ztmab9cgc0**** | The ID of the ECS instance. |
InvokeId | t-hz01x7rtjfy**** | The ID of the execution. |
CommandId | c-hz01x7cn5aj**** | The ID of the command. |
CommandName | cmd-hostname | The name of the command. |
CommandType | RunShellScript | The type of the command. |
CommandContent | hostname | The plaintext content of the command. |
ResourceOwnerUid | 160998252992**** | The Alibaba Cloud account ID of the command caller. |
CallerUid | 160998252992**** | The account ID of the command caller. |
CallerType | customer | The call mode of the command caller. |
Timeout | 60 | The timeout period for the command to run on the ECS instance. Unit: seconds. |
Frequency | 0 * 14 * * ? | The schedule on which the recurring executions of the command take place. The value of this parameter is a cron expression. For more information, see Cron expression. |
Parameters | {} | The key-value pairs of custom parameters to be passed in when the command can include custom parameters. |
Username | root | The username that is used to run the command on the ECS instance. |
RepeatMode | Period | The execution mode of the command. |
Repeats | 2 | The number of times that the command was run on the ECS instance. |
InvocationStatus | Success | The command state on a single ECS instance. |
ErrorCode | InstanceNotExists | The error code returned when the command cannot be sent or run. |
ErrorInfo | the specified instance does not exists | The error message returned when the command cannot be sent or run. |
Dropped | 0 | The size of truncated and discarded text when the size of text in the Output response parameter is larger than 24 KB. |
Output | iZbp1hd5ztmab9cgc0****\n | The command output. |
ExitCode | 0 | The exit code of the command. |
CreationTime | 2021-09-26T05:47:20Z | The creation time of the execution. |
StartTime | 2021-09-26T05:47:20Z | The time when the command started to run on the ECS instance. |
UpdateTime | 2021-09-26T06:53:00Z | The time when the execution state was updated. |
FinishedTime | 2021-09-26T06:53:00Z | The completion time of the execution. |
StopTime | 2021-09-26T06:53:00Z | The time when the command stopped being run on the ECS instance. If you called the StopInvocation operation to manually stop the execution, the value is the time when the operation was called. |
Parameter | Example | Description |
---|---|---|
RegionId | cn-hangzhou | The region ID of the ECS instance to which the file was sent. |
InstanceId | i-bp1hd5ztmab9cgc0**** | The ID of the ECS instance. |
InvokeId | f-hz01xeva44**** | The ID of the execution. |
FileName | sendfile-test.txt | The name of the file. |
ContentType | Base64 | The content type of the file. |
Description | Used for test | The description of the file. |
FileContent | c2VuZCBmaWxlIHRlc3Q= | The content of the file. |
FileGroup | root | The group of the file. |
FileMode | 0644 | The permissions on the file. |
FileOwner | root | The owner of the file. |
ResourceOwnerUid | 16099825299**** | The Alibaba Cloud account ID of the file sender. |
CallerUid | 16099825299**** | The account ID of the file sender. |
CallerType | customer | The call mode of the file sender. |
Overwrite | true | Specifies whether to overwrite a file in the destination directory if the file has the same name as the sent file. |
TargetDir | /root | The destination directory to which the file is sent. |
Timeout | 60 | The timeout period for sending the file. Unit: seconds. |
InvocationStatus | Success | The state of the file-sending task. |
ErrorCode | FileAlreadyExists | The error code returned when the file cannot be sent to the ECS instance. |
ErrorInfo | File already exists: sendfile-test.txt | The error message returned when the file cannot be sent to the ECS instance or when the file-sending task cannot be executed on the ECS instance. |
CreationTime | 2021-09-28T05:31:04Z | The creation time of the file-sending task. |
StartTime | 2021-09-28T05:31:04Z | The time when the file-sending task started to be executed on the ECS instance. |
UpdateTime | 2021-09-28T05:31:04Z | The time when the state of the file-sending task was updated. |
FinishTime | 2021-09-28T05:31:04Z | The time when the file-sending task finished being executed. |