Querying Audit Logs

Function

This API is used to query the list of users' audit logs. The following table lists parameters involved in the API.

Table 1 Parameter description

Parameter

Description

resource_type

Resource type. The parameter value can be job, template, and cluster.

cursor

Job ID, template ID, or cluster ID.

resource_id

Resource ID.

page_number

Page number that is queried.

limit

Maximum number of records that can be queried. A maximum of 50 records can be queried.

URI

  • URI format

    GET /v1.0/{project_id}/audit_logs

  • Parameter description
    Table 2 URI parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

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

Request

None

Response

  • Example response
    [
      {
        "message_id": "CS.10001",
        "message": "Querying audit logs succeeds.",
        "current_time": 1533870937432,
        "payload": {
          "total": 0,
          "traces": [
            {
              "resource_id": "10000",
              "resource_name": "my job",
              "event_name": "startJob",
              "event_type": "ConsoleAction",
              "event_rating": "normal",
              "op_user": "cs_testuser",
              "op_time": 1533869273712,
              "op_ip": "10.218.216.118",
              "op_result": "CS.14000::RUN_JOB_SUCCESS:: The request for submitting CS jobs is delivered successfully."
            }
          ]
        }
      }
    ]
  • Parameter description
    Table 3 Response parameters

    Parameter

    Mandatory

    Type

    Description

    message_id

    No

    Sting

    Message type ID.

    message

    No

    Sting

    Message content.

    current_time

    No

    Int

    Current time, expressed by milliseconds.

    payload

    No

    None

    Information about the job audit log.

    total

    No

    Int

    Total number of audit log records in the query result.

    traces

    No

    None

    Information about the audit log.

    resource_id

    Yes

    Long

    Job ID.

    resource_name

    Yes

    String

    Job name.

    event_name

    Yes

    String

    Event name.

    event_type

    Yes

    String

    Event type.

    event_rating

    Yes

    String

    Event level.

    op_user

    Yes

    String

    Name of job status.

    op_time

    Yes

    String

    Event recording time.

    op_ip

    Yes

    String

    IP address of the operator.

    op_result

    Yes

    String

    Operation result.

Status Code

Table 4 Status code

Status Code

Description

200

The query of audit logs succeeds.

400

The input parameters are invalid.

Error Code

For details, see Error Codes.