Querying Service Event Logs

Function

This API is used to query service event logs, including service operation records, key actions during deployment, and deployment failure causes.

URI

GET /v1/{project_id}/services/{service_id}/events

Table 1 describes the required parameters.
Table 1 Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

service_id

Yes

String

Service ID

Table 2 Parameters

Parameter

Mandatory

Type

Description

event_type

No

String

Type of the event to be filtered. By default, the event type is not filtered. Options:

  • normal: normal events
  • abnormal: abnormal events

start_time

No

Number

Start time of the event to be filtered. The value is milliseconds between the current time and '1970.1.1 0:0:0 UTC'.

end_time

No

Number

End time of the event to be filtered. The value is milliseconds between the current time and '1970.1.1 0:0:0 UTC'.

offset

No

Integer

Start page of the paging list. Default value: 0

limit

No

Integer

Maximum number of records returned on each page. Default value: 1000

sort_by

No

String

Specified sorting field. The default value is occur_time.

order

No

String

Sorting mode. The default value is desc. Options:

  • asc: ascending order
  • desc: descending order

Request Body

None

Response Body

Table 3 describes the response parameters.
Table 3 Parameters

Parameter

Type

Description

service_id

String

Service ID

service_name

String

Service name

events

event array

Event logs. For details, see Table 4.

total_count

Integer

Total number of events that meet the search criteria when no paging is implemented

count

Integer

Number of events in the query result

Table 4 event structure

Parameter

Type

Description

occur_time

Number

Time when an event occurs. The value is milliseconds between the current time and '1970.1.1 0:0:0 UTC'.

event_type

String

Event type. Possible values are normal and abnormal, indicating whether the event is normal or abnormal.

event_info

String

Event information,' including service operation records, key actions during deployment, and deployment failure causes.

Samples

The following example queries event information of the service whose ID is 35de3ca9-1bca-4ae7-9cb0-914f30fa7d3e.

Status Code

For details about the status code, see Table 1.

Error Codes

See Error Codes.