You need to enable JavaScript to run this app.
Volcengine Kubernetes Engine

Volcengine Kubernetes Engine

Copy page
Download PDF
Log management
Collecting container logs
Copy page
Download PDF
Collecting container logs
VKE clusters allow you to collect container logs, including standard output logs and file path logs, by using TLS of Volcano Engine. This topic describes how to configure and view container logs.​
tip​
This topic describes log collection methods for standard containers. For log collection methods for Volcengine Container Instance (VCI), see Collecting VCI container logs by using TLS.​
Limit​
To collect logs in JSON format, you need to upgrade the log-collector add-on to v1.2.5 or later. For details, see Add-on release records.​
Prerequisites​
  • TLS has been activated. To activate this service, log in to the TLS console and activate the service based on the on-screen prompts.​
tip​
If the add-on is not installed, you will be prompted to install the add-on on the Log management page. Install the log-collector add-on based on the on-screen prompts.​
Procedure​
VKE allows you to collect standard output (Stdout), standard error (Stderr), and text logs of containers. Procedure:​
  1. Log in to the VKE console.​
  1. In the left navigation bar, click Cluster. On the page that appears, click the name of the target cluster to go to its management page.​
  1. In the left navigation bar, click Log management. Then, click the Log collection rule tab.​
  1. Click Create collection rule to configure a container log collection rule.​
  • Select log space: Specify the IAM project, Project, and Topic parameters. After you complete the configuration, click Next step: Collection rule.​
  • Collection rule: Configure a collection rule for container logs, including log collection type and collection target. After you complete the configuration, click Next step: Check the index configuration.​
Description​
This topic only describes the commonly required parameters when you configure collection rules. For more parameter descriptions, see Collecting container standard output and Collecting container text logs.​
  • ​
    Standard output logs
    Container text logs
    ​
    VKE allows you to collect standard output (Stdout) and standard error (Stderr) logs of containers.​
    ​
    Parameters​
    Description​
    Configuration basic information​
    ​
    Regular alias​
    Specify a name for the collection rule.​
    Click Import other collection configurations to import other created collection configurations.​
    Container log collection​
    Select Enable to enable container log collection.​
    Acquisition type​
    Select the container log collection type. K8s container standard output and K8s container text log are supported. In this example, select K8s container standard output.​
    Collection information​
    Select container log collection information. Valid values: Standard output - stdout and Standard error - stderr.​
    Common container collection rule​
    Specify the log collection target and content by using the general information of the container. For specific parameter descriptions, see Collecting container standard output.​
    tip​
    If you do not specify a general container collection rule, logs from all containers in the cluster will be collected.​
    K8s collection rules​
    Specify the log collection target and content by using Kubernetes container information. For specific parameter descriptions, see Collecting container standard output.​
    Description​
    If you do not specify a Kubernetes collection rule, logs from all containers in the cluster will be collected.​
    Configure Log Format​
    ​
    Collection mode​
    Select a log file parsing mode. You can select an appropriate collection mode based on your business scenarios and configure a log parsing rule in the specified mode. For details of different modes, see the following topics:​
    ​
    ​
    ​
  • Check the index configuration: Specify or update indexes based on the on-screen prompts as needed. You can also click Import existing index configuration to import indexes from other log topics.​
  • If no indexes are configured for the current log topic, configure one based on the instructions in Configuring indexes.​
  • If an index is already configured for the current log topic, determine whether to update the index based on the log fields parsed in the collection rule.​
tip​
  • You can query and analyze the collected log data only if you enable the index.​
  • The updated index settings only take effect on subsequently written data. For other usage instructions and limitations about query and analysis, see Query overview and Analysis overview.​
  1. Click Submit to complete the configuration.​
Validating results​
  1. In the left navigation bar of the cluster management page, click Log management.​
  1. Click the Container log tab and specify a log project and log topic to view the container logs of the current cluster.​
tip​
  1. Enter the index content, such as __pod_name__ : "log-collector-lptnx", select the query time range, and then click Search to view the logs of the specified container.​
Other configurations​
Filtering collected data​
During log collection, a large number of less significant or irrelevant logs (such as logs at the DEBUG/INFO level) exist, which wastes storage resources, increases costs, and affects query efficiency. Therefore, you can achieve efficient and secure log collection by using fine-grained filtering policies.​
​
Filter by collection rule
Filter by content
​
You can specify collection conditions by using the container metadata (such as container name, container label, and container environment variables) or Kubernetes container information (such as namespace, workload type, and workload name) when you configure a collection rule. This specifies specific containers from which the logs are to be collected. Procedure:​
When you configure the collection rule, enable Common container collection rule or K8s collection rules based on your business requirements, and configure the details of the collection rule.​
​
Collection rule​
Configuration description​
Common container collection rule​
  • Container name: Specify the name of the container whose logs are to be collected. Regular expression matching is supported. For example, if you set the container name to ^(container-demo)$, the logs of all containers named container-demo are collected.​
  • Container label allowlist and blocklist: You can specify containers whose logs are to be collected using container labels.​
  • Container environment variable allowlist and blocklist: You can specify containers whose logs are to be collected by using container environment variables.​
K8s collection rules​
  • Namespace: Specify containers from which the logs are to be collected by namespace. Regular expressions are supported. For example, if you set the namespace name to ^default$, the logs of all containers in the default namespace are to be collected.​
  • Workload type: Specify the workload types of the containers from which to collect logs, including Deployment, StatefulSet, DaemonSet, Job, and CronJob.​
  • Workload name: Specify containers from which the logs are to be collected by workload name. Regular expression matching is supported. For example, if you set the workload name to ^(http.*)$, the logs of all containers in workloads whose names start with http are to be collected.​
  • Pod label allowlist and blocklist: You can specify specific containers whose logs are to be collected by using pod labels.​
  • Pod annotation allowlist and blocklist: You can specify containers whose logs are to be collected by using pod annotations.​
  • Pod name matching rule: Specify the names of pods whose logs are to be collected. Regular expression matching is supported. For example, if you set the pod name to ^(container-test)$, the logs of all pods named container-test are collected.​
​
​
​
Managing collection rules​
  1. In the left navigation bar of the cluster management page, click Log management. On the page that appears, click the Log collection rule tab to view collection rules.​
  1. In the collection rule list, click Edit or Delete in the Actions column to update or delete the corresponding collection rule.​
  • ​
    Actions​
    Description​
    Edit​
    Update an existing log collection rule.​
    Delete​
    Delete an existing log collection rule.​
    warning​
    • If the log-collector add-on has been upgraded to v1.1.0 or later, after you delete a log collection rule, the associated collection rule in the TLS console will be automatically deleted. Proceed with caution.​
    • If the log-collector add-on has not been upgraded, after you delete a log collection rule, the content in the TLS console will not be affected.​
    ​
​
​
​
Last updated: 2026.07.24 10:53:28