Updated on 2025-09-09 GMT+08:00

Reporting Events

Function

An API for reporting custom events is provided, which helps you collect and report abnormal events or important change events to Cloud Eye.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

POST /V1.0/{project_id}/events

  • Parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Definition

    Project ID, which is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details about how to obtain the project ID, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    1 to 64 characters

    Default Value

    N/A

  • Example
    POST https://{Cloud Eye endpoint}/V1.0/{project_id}/events

Request

  • Events with the same time, project_id, event_source, event_name, event_type, sub_event_type, event_state, event_level, event_user, resource_id and resource_name fields are considered as the same event.
  • Event subcategory parameters are only available in regions CN East-Shanghai1, CN East-Shanghai2, CN North-Beijing4, and CN South-Guangzhou.
  • Request parameters
    Table 2 Parameter description

    Parameter

    Type

    Mandatory

    Description

    [Array element]

    Array of EventItem objects

    Yes

    Definition

    Request parameter for reporting custom events.

    Constraints

    Array length: [1,100]

    Table 3 Parameter description of the EventItem field

    Parameter

    Mandatory

    Type

    Description

    event_name

    Yes

    String

    Definition

    Event name.

    Constraints

    N/A

    Range

    The value must start with a letter and can contain 1 to 64 characters. It can only contain letters, digits, and and underscores (_).

    Default Value

    N/A

    event_source

    Yes

    String

    Definition

    Event source.

    Constraints

    N/A

    Range

    The format is service.item. Set this parameter based on the site requirements.

    service and item each must be a string that starts with a letter and contains 3 to 32 characters, including only letters, digits, and underscores (_).

    Default Value

    N/A

    time

    Yes

    Long

    Definition

    Time when the event occurred. The value is a UNIX timestamp, in milliseconds.

    Constraints

    Since there is a latency between the client and the server, the timestamp when data was inserted must be within the time range [Current time – 1h + 10s, Current time + 10 mins – 10s]. In this way, the data will be inserted to the database without being affected by the latency.

    Range

    The timestamp when data was inserted must be within the time range [Current time – 1h + 10s, Current time + 10 mins – 10s].

    Default Value

    N/A

    detail

    Yes

    Detail object

    Definition

    Event details.

    For details, see Table 4.

    Constraints

    N/A

    Table 4 detail data structure description

    Parameter

    Mandatory

    Type

    Description

    content

    No

    String

    Definition

    Event content.

    Constraints

    N/A

    Range

    0 to 4,096 characters

    Default Value

    N/A

    NOTE:

    In some scenarios, this field does not support \n. When this happens, \n is preferentially converted to \\n.

    group_id

    No

    String

    Definition

    Resource group that the event belongs to.

    This ID must be the ID of an existing resource group.

    To query the group ID, perform the following steps:

    1. Log in to the management console.
    2. Click Cloud Eye.
    3. Choose Resource Groups.

      Obtain the resource group ID in the Name /ID column.

    Constraints

    N/A

    Range

    24 characters

    Default Value

    N/A

    resource_id

    No

    String

    Definition

    Resource ID.

    To query the resource ID, perform the following steps:

    1. Log in to the management console.
    2. Under Computing, select Elastic Cloud Server.

      On the Resource Overview page, obtain the resource ID.

    Constraints

    N/A

    Range

    The value allows a maximum of 128 characters and can only contain letters, digits, underscores (_), hyphens (-), and colons (:). Example: 6a69bf28-ee62-49f3-9785-845dacd799ec

    Default Value

    N/A

    resource_name

    No

    String

    Definition

    Resource name.

    Constraints

    N/A

    Range

    The value allows a maximum of 128 characters and can contain letters, digits, underscores (_), hyphens (-), and periods (.).

    Default Value

    N/A

    event_state

    No

    String

    Definition

    Event status.

    Constraints

    N/A

    Range

    The value can be:

    • normal: normal
    • warning: abnormal
    • incident: critical

    Default Value

    N/A

    event_level

    No

    String

    Definition

    Event severity.

    Constraints

    N/A

    Range

    The value can be:

    • Critical
    • Major
    • Minor
    • Info

    Default Value

    N/A

    event_user

    No

    String

    Definition

    Event user.

    Constraints

    N/A

    Range

    The value allows 0 to 64 characters and can contain letters, digits, underscores (_), hyphens (-), and spaces.

    Default Value

    N/A

    event_type

    No

    String

    Definition

    Event type.

    Constraints

    EVENT.SYS indicates a system event, which is not from users. Only EVENT.CUSTOM can be transferred.

    Range

    The value can be:

    • EVENT.SYS: system event
    • EVENT.CUSTOM: custom event

    Default Value

    N/A

    sub_event_type

    No

    String

    Definition

    Event subcategory.

    Constraints

    N/A

    Range

    The options are as follows: If the event type is system event, the value can be SUB_EVENT.OPS (O&M event) or SUB_EVENT.PLAN (planned event).

    If the event type is custom event, the value is SUB_EVENT.CUSTOM (custom event).

    Default Value

    SUB_EVENT.OPS

    dimensions

    No

    Array of objects

    Definition

    Event dimension. Resource information is described by dimension.

    Event alarm rules can be configured by dimension to monitor specified resources and resource groups.

    For parameter details, see Table 5.

    Constraints

    A maximum of four dimensions are supported.

    Table 5 dimensions data structure description

    Parameter

    Type

    Mandatory

    Description

    name

    String

    Yes

    Definition

    Resource dimension, for example, instance_id for ECSs. For details about the dimension of each service, see the key field in Services Interconnected with Cloud Eye.

    Constraints

    N/A

    Range

    1 to 32 characters

    Default Value

    N/A

    value

    String

    Yes

    Definition

    Resource dimension value, which is the instance ID of the resource, for example, 4270ff17-aba3-4138-89fa-820594c39755 (ECS ID).

    Constraints

    N/A

    Range

    1 to 256 characters

    Default Value

    N/A

  • Example request
    [
     {
      "event_name": "systemInvaded",
      "event_source": "financial.System",
      "time": 1742264993000,
      "detail": {
       "content": "The financial system was invaded",
       "group_id": "rg15221211517051YWWkEnVd",
       "resource_id": "1234567890sjgggad",
       "resource_name": "ecs001",
       "event_state": "normal",
       "event_level": "Major",
       "event_user": "xiaokong",
       "event_type": "EVENT.CUSTOM",
       "sub_event_type": "SUB_EVENT.CUSTOM",
       "dimensions": [
        {
         "name": "instance_id",
         "value": "instance_xxx"
        }
       ]
      }
     }
    ]

Response

  • Response parameters
    Table 6 Parameter description

    Parameter

    Type

    Description

    Array elements

    Array of objects

    Definition

    Event list.

    For details, see Table 7.

    Table 7 Response parameters

    Parameter

    Mandatory

    Type

    Description

    event_id

    Yes

    String

    Definition

    Event ID.

    Range

    N/A

    event_name

    Yes

    String

    Definition

    Event name.

    Range

    N/A

  • Example response
    [
           {
                "event_id":"evdgiqwgedkkcvhdjcdu346",
                "event_name":"systemInvaded"
            }
    ]

Returned Values

  • Normal

    201

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error.

    401 Unauthorized

    The authentication information is not provided or is incorrect.

    403 Forbidden

    Access to the requested page is forbidden.

    408 Request Timeout

    The request timed out.

    429 Too Many Requests

    Concurrent requests are excessive.

    500 Internal Server Error

    Failed to complete the request because of an internal service error.

    503 Service Unavailable

    The service is currently unavailable.

Error Codes

See Error Codes.