Queries historical events.

When you call this operation to query historical events, you can query the events 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 historical events 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 Real-time subscription and consumption.

Note The LookupEvents operation in the ActionTrail API of version 2017-12-04 will no longer be available. We recommend that you use the LookupEvents operation in the ActionTrail API of version 2020-07-06. For more information, see LookupEvents.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes LookupEvents

The operation that you want to perform. Set the value to LookupEvents.

Event String No AD9CD9DA-EC2D-4EB7-A817-C0442A94****

The ID of the event.

Request String No AD9CD9DA-EC2D-4EB7-A817-C0442A94****

The ID of the request.

EventType String No ConsoleSignin

The type of the event. Valid values:

  • ApiCall: specifies an API call.
  • ConsoleOperation: specifies an operation in the Alibaba Cloud Management Console.
  • AliyunServiceEvent: specifies an operation that is automatically performed by an Alibaba Cloud service.
  • PasswordReset: specifies a password reset.
  • ConsoleSignin: specifies a logon to the Alibaba Cloud Management Console.
  • ConsoleSignout: specifies a logoff from the Alibaba Cloud Management Console.
ServiceName String No AsaSub

The name of the Alibaba Cloud service.

EventName String No ConsoleSignin

The name of the event.

User String No yanjie.wyj

The name of the RAM user who calls the operation.

ResourceType String No Instance

The type of the resource.

ResourceName String No i-bp14664y88udkt45****

The name of the resource.

EventRW String No Write

The read/write type of the event. Valid values:

  • Read: specifies a read event.
  • Write: specifies a write event. It is the default value.
  • All: specifies read and write events.
EventAccessKeyId String No LTAI4FoDkCf4DU1bic1V****

The AcessKey ID used in the event.

NextToken String No 20

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.
MaxResults String No 20

The maximum number of entries to be returned.

Valid values: 0 to 50.

StartTime String No 2020-06-15T14:00:00Z

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. The time must be in UTC. Format: YYYY-MM-DDThh:mm:ssZ.

Note The maximum time range is 30 days. You can query the events that are generated in the recent 90 days.
EndTime String No 2020-06-22T14:00:00Z

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

Note The maximum time range is 30 days. You can query the events that are generated in the recent 90 days.

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

Response parameters

Parameter Type Example Description
Events List AD9CD9DA-EC2D-4EB7-A817-C0442A94****

The returned events.

NextToken String 1

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.
StartTime String 2020-07-15T14:00:00Z

The beginning of the time range when events were queried.

EndTime String 2020-07-22T14:00:00Z

The end of the time range when events were queried.

RequestId String FD79665A-CE8B-49D4-82E6-5EE2E0E791DD

The ID of the request.

Examples

Sample request

http(s)://[Endpoint]/? Action=LookupEvents
&<Common request parameters>

Sample success response

JSON format

{
    "RequestId": "AB6843AF-C07E-4B59-BBF8-A0CEB785E6A2",
    "NextToken": "2",
    "EndTime": "2020-11-26T01:30:39Z",
    "Events": [
        {
            "eventId": "96.227_1606286128938_****",
            "eventVersion": "1",
            "errorMessage": "success",
            "eventSource": "signin.aliyun.com",
            "sourceIpAddress": "42.120.XX.XX",
            "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
            "eventType": "ConsoleSignin",
            "userIdentity": {
                "accountId": "159498693826****",
                "principalId": "24611178745315****",
                "type": "ram-user",
                "userName": "wb-bx66****"
            },
            "serviceName": "AasSub",
            "additionalEventData": {
                "callbackUrl": "https://api.aliyun.com/new?spm=a2c1g.8271268.10000.9.2d59df259iBwq1",
                "mfaChecked": "false"
            },
            "requestId": "96.227_1606286128938_2847",
            "eventTime": "2020-11-25T06:35:29Z",
            "acsRegion": "cn-hangzhou",
            "eventName": "ConsoleSignin"
        },
        {
            "eventId": "132.20_1606132532480_****",
            "eventVersion": "1",
            "errorMessage": "success",
            "eventSource": "signin.aliyun.com",
            "sourceIpAddress": "42.120.XX.XX",
            "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36",
            "eventType": "ConsoleSignin",
            "userIdentity": {
                "accountId": "159498693826****",
                "principalId": "26855899827085****",
                "type": "ram-user",
                "userName": "yuge.****"
            },
            "serviceName": "AasSub",
            "additionalEventData": {
                "callbackUrl": "https://home.console.aliyun.com/",
                "mfaChecked": "false"
            },
            "requestId": "132.20_1606132532480_7292",
            "eventTime": "2020-11-23T11:55:32Z",
            "acsRegion": "cn-hangzhou",
            "eventName": "ConsoleSignin"
        }
    ],
    "StartTime": "2020-11-19T01:31:09Z"
}

Error codes

HTTP status code Error code Error message Description
400 IncompleteSignature The request signature does not conform to Alibaba Cloud standards. The error message returned because the request signature does not conform to the standards of Alibaba Cloud. Check whether the AccessKey ID and AccessKey secret are valid and whether the signature method is appropriate. For more information, see Request signatures.
400 InvalidParameterCombination The end time must be later than the start time. The error message returned because the end of the time range is earlier than or equal to the beginning.
400 InvalidQueryParameter The specified query parameter is invalid. The error message returned because the specified request parameters are invalid.
400 InvalidParameterDateOutOfRange Query time range exceeds 30 days. The error message returned because the specified time range exceeds 30 days.
400 InvalidParameterEndTime The specified EndTime is invalid. The error message returned because the value of the EndTime parameter is invalid.
400 InvalidParameterStartTime The specified StartTime is invalid. The error message returned because the value of the StartTime parameter is invalid.
400 InvalidParameterStartTimeExceedsCurrent The StartTime exceeds the current time. Use GMT time format for queries. The error message returned because the beginning of the time range is later than the current time. Specify a valid time range in GMT.
400 InvalidParameterStartTimeOutOfDate The StartTime exceeds the limit of 90 days. The error message returned because the beginning of the time range is more than 90 days before the current time.
400 InvalidTimeRangeException The end time must be later than the start time. The time span cannot exceed 30 days. The error message returned because the specified time range is invalid. The end of the time range must be later than the beginning and the time range must not exceed 30 days.

For a list of error codes, visit the API Error Center.