Query event history

2024-08-23 10:14:19  Updated

Description

You can call this operation to query event history in OCP by event type, operation event name, resource name, operator ID, event information, event status, or time when the event occurred.

Call description

Prerequisites

You have passed the authentication for the OCP application service.

You have the AUDIT_VIEWER permissions.

Request path

GET /api/v2/audit/events

Request parameters

Parameter Type Required Example value Description
eventType StringArray No COMPUTE_HOST_MANAGEMENT,OB_CLUSTER_MANAGEMENT The event type. For more information, see the following table.
operationEvent StringArray No ADD_OB_ZONES, DELETE_OB_ZONES The operation event name. For more information, see the following table.
resourceName String No my_ob_cluster The resource name. For OceanBase cluster management and backup & recovery, the resource name is the cluster name. For host management, the resource name is the IP address of the host. For tenant management, the resource name is in the format of cluster name:tenant name. For OCP user management, the resource name is the OCP username. For OCP cluster management, the resource name is the OCP cluster name.
operatorId LongArray No 1,2,3 The ID of the operator, which corresponds to the OCP user ID.
eventInfo String No {"clusterId":1} The event information, which corresponds to the request parameters of the operation event.
status String No SUCCESS The status of the event. Valid values: SUCCESS and FAILED.
startTime OffsetDateTime No 2021-09-07T19:04:42.768+08:00 The start time of the event.
endTime OffsetDateTime No 2021-09-08T19:04:42.768+08:00 The end time of the event.
page Integer No 1 The number of the page to return.
size Integer No 10 The number of entries to return on each page.
order String No startTime,desc The rule of data sorting.

Event types

Event type Description
BACKUP_RESTORE Backup and recovery.
COMPUTE_HOST_MANAGEMENT Host management.
OB_CLUSTER_MANAGEMENT OceanBase cluster management.
OB_PROXY_CLUSTER_MANAGEMENT OBProxy management.
OB_TENANT_MANAGEMENT Tenant management.
OCP_USER_MANAGEMENT OCP user management.
OCP_CLUSTER_MANAGEMENT OCP cluster management.

Operation events

Operation event Event type Description
CREATE_SAMPLING_INSPECT_STRATEGY BACKUP_RESTORE Create an inspection policy.
CREATE_BACKUP_STRATEGY BACKUP_RESTORE Create a backup strategy.
START_DATA_BACKUP BACKUP_RESTORE Initiate data backup.
START_RESTORE_TENANT BACKUP_RESTORE Initiate tenant recovery.
START_LOG_BACKUP BACKUP_RESTORE Initiate log backup.
UPDATE_HOST COMPUTE_HOST_MANAGEMENT Modify host information.
ADD_HOSTS COMPUTE_HOST_MANAGEMENT Add a host.
REINSTALL_OCP_AGENT COMPUTE_HOST_MANAGEMENT Reinstall OCP-Agent.
RESTART_OCP_AGENT COMPUTE_HOST_MANAGEMENT Restart OCP-Agent.
STOP_OCP_AGENT COMPUTE_HOST_MANAGEMENT Stop OCP-Agent.
INSTALL_OCP_AGENT COMPUTE_HOST_MANAGEMENT Install OCP-Agent.
DELETE_OB_SERVERS OB_CLUSTER_MANAGEMENT Delete an OBServer.
PATCH_COMPACTION_SETTINGS OB_CLUSTER_MANAGEMENT Delete a zone from an OceanBase cluster.
ADD_OB_ZONES OB_CLUSTER_MANAGEMENT Add a zone for an OceanBase cluster.
ADD_OB_ZONES OB_CLUSTER_MANAGEMENT Add a zone for an OceanBase cluster.
REPLACE_OB_SERVER OB_CLUSTER_MANAGEMENT Replace an OBServer.
DELETE_OB_SERVERS OB_CLUSTER_MANAGEMENT Delete an OBServer.
RESTART_OB_SERVER OB_CLUSTER_MANAGEMENT Restart an OBServer.
START_OB_SERVER OB_CLUSTER_MANAGEMENT Start an OBServer
CREATE_OB_CLUSTER OB_CLUSTER_MANAGEMENT Create an OceanBase cluster.
START_OB_CLUSTER OB_CLUSTER_MANAGEMENT Start an OceanBase cluster.
STOP_OB_CLUSTER OB_CLUSTER_MANAGEMENT Stop an OceanBase cluster.
RESTART_OB_CLUSTER OB_CLUSTER_MANAGEMENT Restart an OceanBase cluster.
UPGRADE_OB_CLUSTER OB_CLUSTER_MANAGEMENT Upgrade an OceanBase cluster.
DELETE_OB_CLUSTER OB_CLUSTER_MANAGEMENT Delete an OceanBase cluster.
TAKE_OVER_OB_CLUSTER OB_CLUSTER_MANAGEMENT Take over an OceanBase cluster.
MOVE_OUT_OB_CLUSTER OB_CLUSTER_MANAGEMENT Migrate data from an OceanBase cluster.
SWITCHOVER_OB_CLUSTER OB_CLUSTER_MANAGEMENT Perform daily switchover.
FAILOVER_OB_CLUSTER OB_CLUSTER_MANAGEMENT Perform disaster recovery failover.
UPDATE_OB_CLUSTER_PARAMETERS OB_CLUSTER_MANAGEMENT Modify parameters of an OceanBase cluster.
CHANGE_OB_CLUSTER_PASSWORD OB_CLUSTER_MANAGEMENT Change the password of an OceanBase cluster.
ADD_OB_SERVERS OB_CLUSTER_MANAGEMENT Add an OBServer.
ADD_OB_SERVERS OB_CLUSTER_MANAGEMENT Add an OBServer.
STOP_OB_SERVER OB_CLUSTER_MANAGEMENT Stop an OBServer.
RESTART_OB_PROXIES OB_PROXY_CLUSTER_MANAGEMENT Restart an OBProxy.
CHANGE_PROXY_SYS_PASSWORD OB_PROXY_CLUSTER_MANAGEMENT Change the password of the proxysys account.
PATCH_OB_PROXY_OB_LINK OB_PROXY_CLUSTER_MANAGEMENT Modify an OBLink.
CREATE_OB_PROXY_CLUSTER OB_PROXY_CLUSTER_MANAGEMENT Create an OBProxy cluster.
DELETE_OB_PROXY_CLUSTER OB_PROXY_CLUSTER_MANAGEMENT Delete an OBProxy cluster.
UPGRADE_OB_PROXIES OB_PROXY_CLUSTER_MANAGEMENT Upgrade an OBProxy.
ADD_OB_PROXIES OB_PROXY_CLUSTER_MANAGEMENT Add an OBProxy.
DELETE_OB_PROXY_OB_LINK OB_PROXY_CLUSTER_MANAGEMENT Delete an OBLink.
DELETE_OB_PROXIES OB_PROXY_CLUSTER_MANAGEMENT Delete an OBProxy.
PATCH_OB_PROXY_CLUSTER OB_PROXY_CLUSTER_MANAGEMENT Modify configurations of an OBProxy cluster.
MODIFY_OB_PROXY_PARAMETERS OB_PROXY_CLUSTER_MANAGEMENT Modify parameters of an OBProxy cluster.
ADD_OB_PROXY_OB_LINK OB_PROXY_CLUSTER_MANAGEMENT Add an OBLink.
ADD_OB_PROXY_OB_LINK OB_PROXY_CLUSTER_MANAGEMENT Add an OBLink.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
LOCK_DATABASE_USER OB_TENANT_MANAGEMENT Lock a database user.
UNLOCK_DATABASE_USER OB_TENANT_MANAGEMENT Unlock a database user.
CREATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Create a database role.
DELETE_DATABASE_ROLE OB_TENANT_MANAGEMENT Delete a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
UPDATE_DATABASE_ROLE OB_TENANT_MANAGEMENT Modify a database role.
MODIFY_DATABASE_PRIVILEGE OB_TENANT_MANAGEMENT Modify database privileges.
DELETE_REPLICA OB_TENANT_MANAGEMENT Delete a replica.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
CREATE_TENANT OB_TENANT_MANAGEMENT Create a tenant.
DELETE_TENANT OB_TENANT_MANAGEMENT Delete a tenant.
LOCK_TENANT OB_TENANT_MANAGEMENT Lock a tenant.
UNLOCK_TENANT OB_TENANT_MANAGEMENT Unlock a tenant.
MODIFY_TENANT_PARAMETERS OB_TENANT_MANAGEMENT Modify parameters of a tenant
MODIFY_TENANT_PRIMARY_ZONE OB_TENANT_MANAGEMENT Update the Primary Zone of a tenant.
MODIFY_TENANT_WHITE_LIST OB_TENANT_MANAGEMENT Update the whitelist of a tenant.
ADD_REPLICA OB_TENANT_MANAGEMENT Add a replica.
MODIFY_REPLICA OB_TENANT_MANAGEMENT Modify a replica.
DELETE_UNIT OB_TENANT_MANAGEMENT Delete a resource unit.
CREATE_DATABASE OB_TENANT_MANAGEMENT Create a database.
MODIFY_DATABASE OB_TENANT_MANAGEMENT Modify a database.
CREATE_DATABASE_USER OB_TENANT_MANAGEMENT Create a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
UPDATE_DATABASE_USER OB_TENANT_MANAGEMENT Modify a database user.
DELETE_DATABASE_USER OB_TENANT_MANAGEMENT Delete a database user.
DELETE_DATABASE OB_TENANT_MANAGEMENT Delete a database.
CHANGE_MC_OCP_CLUSTER_CONFIG OCP_CLUSTER_MANAGEMENT Modify parameters of an OCP cluster.
CREATE_USER OCP_USER_MANAGEMENT Create an OCP user.
DELETE_USER OCP_USER_MANAGEMENT Delete an OCP user.
CREATE_ROLE OCP_USER_MANAGEMENT Create an OCP role.
UPDATE_ROLE OCP_USER_MANAGEMENT Modify an OCP role.
DELETE_ROLE OCP_USER_MANAGEMENT Delete an OCP role.
UPDATE_USER OCP_USER_MANAGEMENT Modify an OCP user.
CHANGE_USER_PASSWORD OCP_USER_MANAGEMENT Change the password of an OCP user.

Response parameters

Parameter Type Description
data Object The requested data.
├─ contents Array The AuditEventHistory array. For more information about the data structure, see the following table.
├─ page Object The page information. For more information, see the page parameters.
successful Boolean Indicates whether the request was successful.
timestamp Datetime The timestamp when the server completed the request.
duration Integer The time taken by the server to process the request, in milliseconds.
status Integer An HTTP status code.
traceId String The trace ID of the request. This trace ID is used for troubleshooting.
server String The address of the application server that responded to the request.

Data structure of AuditEventHistory

Parameter Type Description
id Long The ID of the historical event.
operationEvent String The name of the operation event. For more information, see Operation events.
eventType String The type of the event. For more information, see Event types.
resourceType String The type of the resource. Valid values: COMPUTE_HOST, OB_TENANT, OB_CLUSTER, OB_PROXY_CLUSTER, OCP_USER, OCP_ROLE, and OCP_CLUSTER.
resourceId Long The ID of the resource, for example, the host ID, OceanBase cluster ID, OBProxy ID, or tenant ID.
resourceName String The name of the resource, for example, the OceanBase cluster name, host IP address, or tenant name.
parentResource String The name of the parent resource. For example, the parent resource of a tenant is a cluster. When resourceName is set to the tenant name, parentResource must be set to the cluster name.
operatorName String The name of the operator, which corresponds to the OCP username.
operatorId Long The ID of the operator, which corresponds to the OCP user ID.
status String The status of the event. Valid values: SUCCESS and FAILED.
taskId Long The ID of the task. If the event is an O&M task, this parameter indicates the ID of the O&M task.
executionType String The execution type of the O&M task. Valid values: NEW and RETRY.
eventInfo String The request parameters for performing the operation.
clientIp String The IP address of the client that performed the operation.
startTime OffsetDateTime The start time of the operation.
endTime OffsetDateTime The end time of the operation.

Page parameters

Parameter Type Description
totalElements Integer The total number of entries.
totalPage Integer The total number of pages.
number Integer The page number of the returned page.
size Integer The number of entries returned per page.

Examples

Sample request

GET /api/v2/audit/events

Sample response

{
  "data": {
    "contents": [
      {
        "clientIp": "xxx.xxx.xxx.1",
        "endTime": "2021-09-03T10:45:33+08:00",
        "eventInfo": "{\"hostId\":20}",
        "eventType": "COMPUTE_HOST_MANAGEMENT",
        "executionType": "NEW",
        "id": 112,
        "operationEvent": "RESTART_OCP_AGENT",
        "operatorId": 100,
        "operatorName": "admin",
        "resourceId": 20,
        "resourceName": "xxx.xxx.xxx.2",
        "resourceType": "COMPUTE_HOST",
        "startTime": "2021-09-03T10:45:30+08:00",
        "status": "FAILED"
      },
      {
        "clientIp": "xxx.xxx.xxx.1",
        "endTime": "2021-09-03T13:07:41+08:00",
        "eventInfo": "{\"hostId\":20}",
        "eventType": "COMPUTE_HOST_MANAGEMENT",
        "executionType": "NEW",
        "id": 113,
        "operationEvent": "RESTART_OCP_AGENT",
        "operatorId": 100,
        "operatorName": "admin",
        "resourceId": 20,
        "resourceName": "xxx.xxx.xxx.2",
        "resourceType": "COMPUTE_HOST",
        "startTime": "2021-09-03T13:07:39+08:00",
        "status": "FAILED"
      },
      {
        "clientIp": "xxx.xxx.xxx.1",
        "endTime": "2021-09-03T13:07:50+08:00",
        "eventInfo": "{\"hostId\":20}",
        "eventType": "COMPUTE_HOST_MANAGEMENT",
        "executionType": "NEW",
        "id": 114,
        "operationEvent": "RESTART_OCP_AGENT",
        "operatorId": 100,
        "operatorName": "admin",
        "resourceId": 20,
        "resourceName": "xxx.xxx.xxx.2",
        "resourceType": "COMPUTE_HOST",
        "startTime": "2021-09-03T13:07:48+08:00",
        "status": "FAILED"
      }
    ],
    "page": {
      "number": 1,
      "size": 10,
      "totalElements": 3,
      "totalPages": 1
    }
  },
  "duration": 12,
  "server": "a83ad33525",
  "status": 200,
  "successful": true,
  "timestamp": "2021-09-08T19:12:28.387+08:00",
  "traceId": "0a4a965ff3f344c3"
}

Contact Us