调用LookupEvents接口检索历史事件。
使用LookupEvents检索历史事件时,每秒钟最多调用两次。
注意:请勿频繁调用该接口。您可以创建跟踪,将事件投递到日志服务SLS,通过SLS的实时消费功能来近实时地检索历史事件。
说明 该接口(2017-12-04版本API LookupEvents接口)即将下线,推荐您使用2020-07-06版本API。更多信息,请参见LookupEvents。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 | 
| Action | String | 是 | LookupEvents | 要执行的操作,取值:LookupEvents。 | 
| Event | String | 否 | AD9CD9DA-EC2D-4EB7-A817-C0442A94**** | 事件ID。 | 
| Request | String | 否 | AD9CD9DA-EC2D-4EB7-A817-C0442A94**** | 请求ID。 | 
| EventType | String | 否 | ConsoleSignin | 事件类型,取值: 
 | 
| ServiceName | String | 否 | AsaSub | 云服务名称。 | 
| EventName | String | 否 | ConsoleSignin | 事件名称。 | 
| User | String | 否 | yanjie.wyj | 调用者名称,即RAM用户。 | 
| ResourceType | String | 否 | Instance | 资源类型。 | 
| ResourceName | String | 否 | i-bp14664y88udkt45**** | 资源名称。 | 
| EventRW | String | 否 | Write | 请求事件的读写类型,取值: 
 | 
| EventAccessKeyId | String | 否 | LTAI4FoDkCf4DU1bic1V**** | 要检索事件的AccessKey ID。 | 
| NextToken | String | 否 | 20 | 用于请求下一页检索的结果。 说明 请求参数必须保证和上次请求一致。 | 
| MaxResults | String | 否 | 20 | 允许返回的最大结果数目。 取值范围:0~50个。 | 
| StartTime | String | 否 | 2020-06-15T14:00:00Z | 检索事件的开始时间,默认为当前时间7天前的时间点。日期格式按照ISO8601标准,并使用UTC时间。格式为: 说明 支持最长90天内,跨度不超过30天的事件检索。 | 
| EndTime | String | 否 | 2020-06-22T14:00:00Z | 检索事件的结束时间,默认为当前时间点。日期格式按照ISO8601标准,并使用UTC时间。格式为: 说明 支持最长90天内,跨度不超过30天的事件检索。 | 
Event内的子字段说明,请参见操作事件结构定义。
返回数据
| 名称 | 类型 | 示例值 | 描述 | 
| EndTime | String | 2020-07-22T14:00:00Z | 检索到事件的结束时间。 | 
| NextToken | String | 1 | 返回下一页的检索结果。 说明 若无更多结果,则不返回此字段。 | 
| RequestId | String | FD79665A-CE8B-49D4-82E6-5EE2E0E791DD | 请求ID。 | 
| Events | Array of Object | AD9CD9DA-EC2D-4EB7-A817-C0442A94**** | 检索到的事件列表。 | 
| StartTime | String | 2020-07-15T14:00:00Z | 检索到事件的开始时间。 | 
示例
请求示例
http(s)://[Endpoint]/?Action=LookupEvents
&<公共请求参数>正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<LookupEventsResponse>
    <RequestId>AB6843AF-C07E-4B59-BBF8-A0CEB785E6A2</RequestId>
    <NextToken>2</NextToken>
    <EndTime>2020-11-26T01:30:39Z</EndTime>
    <Events>
        <eventId>96.227_1606286128938_****</eventId>
        <eventVersion>1</eventVersion>
        <errorMessage>success</errorMessage>
        <eventSource>signin.aliyun.com</eventSource>
        <sourceIpAddress>42.120.XX.XX</sourceIpAddress>
        <userAgent>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36</userAgent>
        <eventType>ConsoleSignin</eventType>
        <userIdentity>
            <accountId>159498693826****</accountId>
            <principalId>24611178745315****</principalId>
            <type>ram-user</type>
            <userName>alice</userName>
        </userIdentity>
        <serviceName>AasSub</serviceName>
        <additionalEventData>
            <callbackUrl>https://api.aliyun.com/new?spm=a2c1g.8271268.10000.9.2d59df259iBwq1</callbackUrl>
            <mfaChecked>false</mfaChecked>
        </additionalEventData>
        <requestId>96.227_1606286128938_2847</requestId>
        <eventTime>2020-11-25T06:35:29Z</eventTime>
        <acsRegion>cn-hangzhou</acsRegion>
        <eventName>ConsoleSignin</eventName>
    </Events>
    <Events>
        <eventId>132.20_1606132532480_****</eventId>
        <eventVersion>1</eventVersion>
        <errorMessage>success</errorMessage>
        <eventSource>signin.aliyun.com</eventSource>
        <sourceIpAddress>42.120.XX.XX</sourceIpAddress>
        <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</userAgent>
        <eventType>ConsoleSignin</eventType>
        <userIdentity>
            <accountId>159498693826****</accountId>
            <principalId>26855899827085****</principalId>
            <type>ram-user</type>
            <userName>yuge.****</userName>
        </userIdentity>
        <serviceName>AasSub</serviceName>
        <additionalEventData>
            <callbackUrl>https://home.console.aliyun.com/</callbackUrl>
            <mfaChecked>false</mfaChecked>
        </additionalEventData>
        <requestId>132.20_1606132532480_7292</requestId>
        <eventTime>2020-11-23T11:55:32Z</eventTime>
        <acsRegion>cn-hangzhou</acsRegion>
        <eventName>ConsoleSignin</eventName>
    </Events>
    <StartTime>2020-11-19T01:31:09Z</StartTime>
</LookupEventsResponse>JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
  "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" : "alice"
    },
    "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"
}错误码
| HttpCode | 错误码 | 错误信息 | 描述 | 
| 400 | IncompleteSignature | The request signature does not conform to Alibaba Cloud standards. | 签名不匹配。请检查AcceseKey ID和AccessKey Secret是否正确;检查签名方法是否正确。详细信息参见“签名机制”。 | 
| 400 | InvalidParameterCombination | The end time must be later than the start time. | 结束时间必须晚于开始时间。 | 
| 400 | InvalidQueryParameter | The specified query parameter is invalid. | 无效的查询参数。 | 
| 400 | InvalidParameterDateOutOfRange | Query time range exceeds 30 days. | 查询时间范围超出30天。 | 
| 400 | InvalidParameterEndTime | The specified EndTime is invalid. | 无效的参数EndTime。 | 
| 400 | InvalidParameterStartTime | The specified StartTime is invalid. | 无效的参数StartTime。 | 
| 400 | InvalidParameterStartTimeExceedsCurrent | The StartTime exceeds the current time. Use GMT time format for queries. | 开始时间超过当前时间,请使用标准GMT时间查询。 | 
| 400 | InvalidParameterStartTimeOutOfDate | The StartTime exceeds the limit of 90 days. | 开始时间超出90天限制。 | 
| 400 | InvalidTimeRangeException | The end time must be later than the start time. The time span cannot exceed 30 days. | 结束时间应晚于开始时间,且时间跨度不能超过30天。 | 
访问错误中心查看更多错误码。
该文章对您有帮助吗?