Updated on 2024-03-22 GMT+08:00

Collecting Logs from CTS

LTS can collect logs from CTS.

Prerequisites

You have purchased and used a Huawei Cloud CTS instance.

Procedure

Perform the following operations to configure CTS log ingestion:

  1. Log in to the LTS console.
  2. In the navigation pane on the left, choose Log Ingestion and and click CTS (Cloud Trace Service).
  3. Select a log stream.

    1. Select a log group from the Log Group drop-down list. If there are no desired log groups, click Create Log Group to create one.
    2. Select a log stream from the Log Stream drop-down list. If there are no desired log streams, click Create Log Stream to create one.
    3. Click Next: Configure CTS.

  4. Configure CTS.

    Click Configure CTS.
    1. On the CTS console, choose Tracker List in the navigation pane on the left.
    2. Click Create Tracker and configure parameters.
    3. Click Create.

      For details about the procedure and parameter settings, see the Cloud Trace Service User Guide.

  5. Click Next: Configure Log Stream.

    Table 1 Log stream parameters

    Parameter

    Description

    Auto Structure and Index

    If is enabled, the log stream is automatically structured and indexed. The structuring is based on the CTS template, and the indexing enables quick analysis for all parsed CTS fields. Enabling structuring and indexing is required for SQL analysis of CTS logs with visual charts.

  6. Click Submit.

Structuring Template Details

  • Structuring template example
    Table 2 Structuring template example

    Template Name

    Example Log

    CTS

    {"code":"201","source_ip":"10.10.1.10","trace_type":"ApiCall","event_type":"global","project_id":"221123nsada3sda3231das3111ndsab","trace_id":"1eesdd-dad6-11dsaea-edaxfeqdf","trace_name":"demodemodemo","resource_type":"token","trace_rating":"normal","service_type":"IAM","resource_id":"98763hkjhdteoi03861732hjh7983bhd","tracker_name":"global","time":"1597042369296","resource_name":"demodemodemo/demo","record_time":"1597042370464","user":{"domain":{"name":"testdemo","id":"21185d8818e443e1ryjkh71622f09212b"},"name":"testdemo/demo","id":"6hfakl86faqw87dsasasadf09ajbml"}}
  • Structuring fields and description
    Table 3 Structuring fields

    Field

    Example

    Description

    Type

    code

    201

    HTTP return code, such as 200 or 400

    long

    event_type

    global

    Trace type

    string

    project_id

    221123nsada3sda3231das3111ndsab

    Project ID

    string

    record_time

    1597042370464

    Time when the operation was recorded, in the form of a timestamp

    long

    resource_id

    98763hkjhdteoi03861732hjh7983bhd

    Unique resource ID

    string

    resource_name

    demodemodemo/demo

    Resource name

    string

    resource_type

    token

    Resource type

    string

    service_type

    IAM

    Operation source

    string

    source_ip

    10.10.1.10

    IP address of the user that performs an operation. The value of this parameter is empty if the operation is triggered by the system.

    string

    time

    1597042369296

    The time when a trace occurred. The value is the local standard time (UTC+local time zone), for example, 2016/12/08 11:24:04 GMT+08:00. This field is transmitted and stored in the form of a timestamp. It is the total number of milliseconds from 00:00:00, January 1, 1970 (UTC) to the current time.

    long

    trace_id

    1eesdd-dad6-11dsaea-edaxfeqdf

    Unique operation ID

    string

    trace_name

    demodemodemo

    Operation name

    string

    trace_rating

    normal

    Trace status. The value can be normal, warning, or incident.

    • normal: The operation succeeded.
    • warning: The operation failed.
    • incident: The operation caused a serious consequence, for example, a node failure or service interruption.

    string

    trace_type

    ApiCall

    There are five types of operations:

    • ConsoleAction: operations performed on the management console
    • SystemAction: operations triggered by system
    • ApiCall: operations triggered by calling API Gateway
    • ObsSDK: operations on OBS buckets, which were triggered by calling OBS SDKs
    • Others: operations on OBS buckets except those triggered by calling OBS SDKs

    string

    tracker_name

    global

    Tracker name

    string

    user.domain.id

    21185d8818e443e1ryjkh71622f09212b

    Domain ID of a user

    string

    user.domain.name

    testdemo

    Domain name of a user

    string

    user.id

    6hfakl86faqw87dsasasadf09ajbml

    User ID

    string

    user.name

    testdemo/demo

    Username

    string