tencent cloud

Feedback

Log Delivery

Last updated: 2024-06-18 16:23:02
    TencentDB for MySQL offers log delivery feature, which can collect slow log and error log details sourced from TencentDB for MySQL instances and deliver it to Cloud Log Service (CLS) for analysis to quickly monitor and troubleshoot business issues. This document describes how to enable or disable the log delivery feature in the console.

    Prerequisites

    Before using this feature, please ensure that you have enabled CLS.

    Use Limits

    Only two-node/three-node local disk instances and read-only instances support the use of log delivery.

    Slow Log Definition

    Field Value
    Type
    Description
    TIMESTAMP
    -
    Reserved field of CLS, represents the time when the log was generated.
    instance_id
    String
    Database instance ID (e.g., cdb-xxx).
    db_name
    String
    Database name.
    rows_examined
    Long
    Number of scanned rows.
    rows_sent
    Long
    Number of returned rows.
    query_time
    Double
    Execution time (in seconds).
    lock_time
    Double
    Lock wait time (in seconds).
    user_host
    String
    Client information.
    user_name
    String
    Username used by the client to connect to the database instance.
    query_sql
    String
    Slow og SQL.

    Error Log Definition

    Field Value
    Type
    Description
    TIMESTAMP
    -
    Reserved field of CLS, represents the time when the log was generated.
    instance_id
    String
    Database instance ID (e.g., cdb-xxx).
    content
    String
    Content of the error log.
    level
    String
    Level of the error log.
    Such as warning, note and error.
    For logs without a level, the entry would be none, such as deadlock error logs.

    Enabling Slow Log Delivery

    1. Log in to the TencentDB for MySQL console. In the instance list, click the Instance ID to enter the management page.
    2. On the instance management page, select Operation Log > Log Delivery.
    
    3. Under Slow Log Delivery, click the Edit icon.
    4. In the pop-up window, select Enable, configure the following items, then click OK.
    
    Parameter
    Description
    Region
    Select the region for log shipping, supporting offsite shipping.
    Logset Management
    A logset is a classification of log topics for your convenience in managing them. You can Select an existing logset or Create a logset.
    Logset
    Select an existing logset: You can filter from the existing logset in the search box to categorize your slow log delivery.
    Create a logset: You can create a new logset to categorize your slow log delivery. The naming format for creating a logset is cloud_ custom_logset, where the custom field supports only letters, digits, and underscores, with a length of no more than 20 characters.
    Log Topic Management
    A log topic is the fundamental unit for log data collection, storage, search, and analysis. You can Select an existing log topic or Create a log topic.
    Log Topic
    Select an existing log topic: This option can be configured only when an existing logset is selected in logset operations. You may filter the log topics under the selected logset in the search box.
    Create a log topic: Create a new log topic under the selected logset. The naming format for creating a log topic is cloud_custom_topic, where the custom field only supports letters, digits, and underscores, with a length of no more than 20 characters.
    Note:
    You can manage log topic. For more details, see Managing Log Topic.
    Retention Period
    Select the retention period for the slow log data delivery, which defaults to 30 days. It allows you to choose between 1 to 3600 days, and the data will be automatically cleared after the logs expire. If an existing log topic is selected, the retention time will default to match the existing log topic's retention period.
    Index Creation
    Enabled by default. Index configuration is critical for log retrieval and analysis in CLS. Only if the index is enabled, the log can be analyzed and retrieved. Learn More.
    If an existing log topic is selected, the index status will default to match the existing log topic's index status.
    5. After you successfully enable slow log delivery, you can see the Delivery Status is enable under Slow Log Delivery. Clicking on the Log Topic Name will take you to the CLS Console for further analysis and management.
    

    Disable Slow Log Delivery

    Note:
    After disabling the slow log delivery, the generated slow log delivery data will continue to be stored according to the retention period selected when slow log delivery is enabled, and data will be automatically cleared after expiration.
    1. Log in to the TencentDB for MySQL console. In the instance list, click the Instance ID to enter the management page.
    2. On the instance management page, select Operation Log > Log Delivery.
    3. Under Slow Log Delivery, click the Edit icon.
    4. In the pop-up window, select Close and click OK.

    Enabling Error Log Delivery

    1. Log in to the TencentDB for MySQL console. In the instance list, click the Instance ID to enter the management page.
    2. On the instance management page, select Operation Log > Log Delivery.
    3. Under Error Log Delivery, click the Edit icon.
    4. In the pop-up window, select Enable, configure the following items, then click OK.
    
    Parameter
    Description
    Region
    Select the region for log shipping, supporting offsite shipping.
    Logset Management
    A logset is a classification of log topics for your convenience in managing them. You can Select an existing logset or Create a logset.
    Logset
    Select an existing logset: You can filter through existing logsets in the search box to categorize your error log delivery.
    Create a logset: You can create a new logset as the categorization for error log delivery. The naming format for creating a logset is cloud_custom_logset, where the custom field supports only letters, digits, and underscores, with a length of no more than 20 characters.
    Log Topic Management
    A log topic is the fundamental unit for log data collection, storage, search, and analysis. You can Select an existing log topic or Create a log topic.
    Log Topic
    SSelect an existing log topic: This option can be configured only when an existing logset is selected in logset operations. You may filter the log topics under the selected logset in the search box.
    Create a log topic: Create a new log topic under the selected logset. The naming format for creating a log topic is cloud_custom_topic, where the custom field only supports letters, digits, and underscores, with a length of no more than 20 characters.
    Note:
    You can manage log topic. For more details, please refer to Managing Log Topic.
    Retention Period
    Select the retention period for the slow log data delivery, which defaults to 30 days. It allows you to choose between 1 to 3600 days, and the data will be automatically cleared after the logs expire. If an existing log topic is selected, the retention time will default to match the existing log topic's retention period.
    Index Creation
    Enabled by default. Index configuration is critical for log retrieval and analysis in CLS. Only if the index is enabled, the log can be analyzed and retrieved. Learn More.
    If an existing log topic is selected, the index status will default to match the existing log topic's index status.
    5. After you successfully enable slow log delivery, you can see the Delivery Status is enable under Error Log Delivery. Clicking on the Log Topic Name will take you to the CLS Console for further analysis and management.
    

    Disable Error Log Delivery

    Note:
    After disabling the error log delivery, the generated error log data will continue to be stored according to the retention period selected when the error log delivery is enabled, and data will be automatically cleared after expiration.
    1. Log in to the TencentDB for MySQL console. In the instance list, click the Instance ID to enter the management page.
    2. On the instance management page, select Operation Log > Log Delivery.
    3. Under Error Log Delivery, click the Edit icon.
    4. In the pop-up window, select Close and click OK.

    Related Documents

    Logset
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support