tencent cloud

Feedback

Log Collections

Last updated: 2023-03-27 11:08:16

    Log Collection FAQs

    Why can’t I view the logs in CLS console after configuring log collection for the cluster?

    If the log cannot be viewed or is missing, please check whether the following problems exist:
    Check whether you have enabled the index feature for the selected log topic. Index configuration is required for using CLS for log search and analysis. If the index feature is disabled, you cannot view the logs. For more information about index configuration, see Configuring Index.
    
    Check whether the log, audit, and event features use the same topic. If they use the same topic, the logs will be overwritten, resulting in log missing.
    Check whether the selected topic uses two extraction modes. The new extraction mode will overwrite the legacy one.
    Check whether a soft link is used. If "Container File Path" is selected as the collection type, the corresponding path must not be a soft link. Otherwise, the actual path of the soft link will not exist in the container of the collector, resulting in a log collection failure.
    If you use environment variables to enable TKE Serverless log collection and select the role-based authorization method, you need to select CVM as the role entity when creating a role. If you selelct TKE, the authorization fails.
    If the problem persists, please submit a ticket to contact us.

    Where can I view the logs after configuring the log rules?

    1. Log in to the CLS console. In the left sidebar, click Search and Analysis.
    2. On the Search and Analysis page, select the region, log set, and log topic to view logs, and enable full-text index to search for and analyze logs, as shown below:
    

    Using Environment Variables to Enable TKE Serverless Log Collection

    How do Java applications implement multi-line log merging?

    If the log data of an application such as a Java program occupies multiple lines, the line break \\n cannot be used to mark the end of a log. To enable CLS to clearly distinguish each log, you need to configure a configmap with the first-line regular expression. When a log in a line matches the preset regular expression, it is considered as the beginning of a log, and the next matching line will be the end mark of the log. For more information, see Implementing Multi-line Log Merging for TKE Serverless Log Collection.

    How to adjust the log collection configuration to adapt to different log output rates?

    When you use environment variables to enable TKE Serverless log collection, TKE Serverless will start up a log collection component in the Pod sandbox to collect and report logs. Since TKE Serverless limits the memory usage of the log collection component, when the log output rate is too high, the log collection component may be out of memory (OOM). At this time, you can adjust the log collection configuration as needed. The specific method is to manually modify the following Pod annotation to reduce the memory buffer used by the log collection component. This helps reduce the memory usage.
    internal.eks.tke.cloud.tencent.com/tail-buffer-chunk-size: "2M"
    internal.eks.tke.cloud.tencent.com/tail-buffer-max-size: "2M"
    The descriptions of the annotations are shown in the following table. For more information, see Fluent Bit.
    Parameter
    Description
    Default Value
    Buffer_Chunk_Size
    It is used to set the initial buffer size to collect container file logs. It can also be used to increase the buffer size.
    2M
    Buffer_Max_Size
    It is used to set the limit of the buffer size of each monitored file. If the buffer needs to be increased (for example, when long logs are stored), this value can limit the amount of buffer increased. If the buffer size of a file that is read exceeds this limit, the file will be deleted from the monitoring list.
    2M

    What is the standard for outputting the logs of an application in the container of a TKE Serverles cluster?

    The logs of an application in the container of a TKE Serverles cluster should be output to stdout. If the application logs are output to a container file, you need to rotate and clean up the log files regularly, or mount a volume for persistent storage. Otherwise, the 20 GB temporary storage will be used up. For more information, see Pod Temporary Storage
    If you do not know how to clean up the log files, we recommend the following methods:
    Mount a volume for persistent storage. For more information, see Storage Management.
    Enable TKE Serverless log collection. For more information, see Using Environment Variables to Configure Log Collection.
    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