All Products
Search
Document Center

ActionTrail:LookupEvents

Last Updated:Sep 30, 2024

Queries event details.

Operation description

When you call this operation to query event details, you can query the event details at most twice per second.

Note Do not frequently call this operation. You can create a trail to deliver events to Log Service. Then, you can query event details in near real time by using the real-time log consumption feature of Log Service. For more information, see Create a single-account trail, Create a multi-account trail, and Overview .

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
actiontrail:LookupEventsget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NextTokenstringNo

The token used to request the next page of query results.

Note The request parameters must be the same as those of the last request.
eyJhY2NvdW50IjoiMTQyNDM3OTU4NjM4NzE2MSIsImV2ZW50SWQiOiI3MkJDRTExRi02OTU3LTQ0NUItQjY0MC1CNEUyMkM4NUEwQzgiLCJsb2dJZCI6IjgyLTE0MjQzNzk1ODYzODcxNjEiLCJ0aW1lIjoxNjAyMzExNTQwMD****
MaxResultsstringNo

The maximum number of entries to be returned.

Valid values: 0 to 50.

20
StartTimestringNo

The beginning of the time range to query. The default time is seven days prior to the current time. Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

2020-10-08T11:00:00Z
EndTimestringNo

The end of the time range to query. The default time is the current time. Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC.

2020-10-15T11:00:00Z
DirectionstringNo

The order in which details of events are to be retrieved. Valid values:

  • FORWARD: ascending order.
  • BACKWARD: descending order. This is the default value.
BACKWARD
LookupAttributearray<object>No

Query conditions.

objectNo

test

KeystringNo

The key of the query condition. Valid values:

  • ServiceName: the name of a specific Alibaba Cloud service.
  • EventName: the name of a specific event.
  • User: the name of the RAM user who calls a specific operation.
  • EventId: the ID of a specific event.
  • ResourceType: the type of resources.
  • ResourceName: the name of a specific resource.
  • EventRW: the read/write type of events.
  • EventAccessKeyId: the AccessKey ID used in events.
Note You can use only one query condition for each query.
ServiceName
ValuestringNo

The value of the query condition. Valid values:

  • When the LookupAttribute.N.Key parameter is set to ServiceName, you can set this parameter to a value such as Ecs.
  • When the LookupAttribute.N.Key parameter is set to EventName, you can set this parameter to a value such as ConsoleSignin.
  • When the LookupAttribute.N.Key parameter is set to User, you can set this parameter to a value such as Alice.
  • When the LookupAttribute.N.Key parameter is set to EventId, you can set this parameter to a value such as B702AFA3-FD4B-40E3-88E4-C0752FAA****.
  • When the LookupAttribute.N.Key parameter is set to ResourceType, you can set this parameter to a value such as ACS::ECS::Instance.
  • When the LookupAttribute.N.Key parameter is set to ResourceName, you can set this parameter to a value such as i-bp14664y88udkt45****.
  • When the LookupAttribute.N.Key parameter is set to EventRW, you can set this parameter to Read or Write.
  • When the LookupAttribute.N.Key parameter is set to EventAccessKeyId, you can set this parameter to a value such as LTAI4FoDkCf4DU1bic1V****.
Ecs

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object

test

EndTimestring

The end of the time range when event details were queried.

2020-07-22T14:00:00Z
NextTokenstring

The token used to return the next page of query results.

Note This parameter is not returned if no more results are to be returned.
eyJhY2NvdW50IjoiMTQyNDM3OTU4NjM4NzE2MSIsImV2ZW50SWQiOiI3MkJDRTExRi02OTU3LTQ0NUItQjY0MC1CNEUyMkM4NUEwQzgiLCJsb2dJZCI6IjgyLTE0MjQzNzk1ODYzODcxNjEiLCJ0aW1lIjoxNjAyMzExNTQwMD****
RequestIdstring

The ID of the request.

FD79665A-CE8B-49D4-82E6-5EE2E0E791DD
Eventsarray<object>

The returned event details.

For more information about the fields in an event log, see ActionTrail event log reference.

Eventsobject
StartTimestring

The beginning of the time range when event details were queried.

2020-07-15T14:00:00Z

Examples

Sample success responses

JSONformat

{
  "EndTime": "2020-07-22T14:00:00Z",
  "NextToken": "eyJhY2NvdW50IjoiMTQyNDM3OTU4NjM4NzE2MSIsImV2ZW50SWQiOiI3MkJDRTExRi02OTU3LTQ0NUItQjY0MC1CNEUyMkM4NUEwQzgiLCJsb2dJZCI6IjgyLTE0MjQzNzk1ODYzODcxNjEiLCJ0aW1lIjoxNjAyMzExNTQwMD****",
  "RequestId": "FD79665A-CE8B-49D4-82E6-5EE2E0E791DD",
  "Events": [
    {
      "test": "test",
      "test2": 1
    }
  ],
  "StartTime": "2020-07-15T14:00:00Z"
}

Error codes

HTTP status codeError codeError messageDescription
400IncompleteSignatureThe request signature does not conform to Alibaba Cloud standards.The request signature does not conform to Alibaba Cloud standards.
400InvalidParameterCombinationThe end time must be later than the start time.The end time must be greater than the start time.
400InvalidQueryParameterThe specified query parameter is invalid.The specified query parameter is not valid.
400InvalidParameterEndTimeThe specified EndTime is invalid.-
400InvalidParameterStartTimeThe specified StartTime is invalid.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history