Creating a Log Stream

Function

This function describes how to create a log stream under a created log group. You can view and query raw logs under a log stream. (Currently, only CN North-Beijing4 is supported.)

URI

  • URI format

    POST /v2/{project_id}/groups/{group_id}/topics

  • Path parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID obtained from Identity and Access Management (IAM). Generally, a project ID is a string containing 32 characters.

    group_id

    Yes

    String

    Group ID of the log group in which the tenant wants to create log streams. Generally, a group ID is a string containing 36 characters.

Request

  • Request header parameter description
    Table 2 Parameter description

    Parameter

    Mandatory

    Type

    Description

    X-Auth-Token

    Yes

    String

    User token obtained from IAM.

    Content-Type

    Yes

    String

    Content type, which is application/json.

  • Request body parameter description
    Table 3 Parameter description

    Parameter

    Mandatory

    Type

    Description

    log_topic_name

    Yes

    String

    Log topic name.

    The configuration rules are as follows:

    • Must be a string of 1 to 64 characters.
    • Only letters, digits, special characters, such as underscores (_), hyphens (-), and periods (.) are allowed. The name cannot start or end with a period.
  • Example request
    POST  /v2/{project_id}/groups/{group_id}/topics
    { 
    "log_topic_name":"lts-topic-13ci"
    }

Response

  • Response parameter description
    Table 4 Parameter description

    Parameter

    Type

    Description

    log_topic_id

    String

    Log stream ID.

  • Example response
    {  
       "log_topic_id":"a25d64c8-3028-11e9-9660-286ed488ce71"
    }

Returned Value