Parameter | Description |
| |
Standard Output | If you turn on Standard Output, Logtail collects container stdout. |
Standard Error | If you turn on Standard Error, Logtail collects container stderr. |
Enable Container Metadata Preview | If you turn on Enable Container Metadata Preview, you can view the container metadata after you create the Logtail configuration, including the matched container information and full container information. |
Container Filtering | Logtail version If the version of Logtail is earlier than 1.0.34, you can use only environment variables and container labels to filter containers. If the version of Logtail is 1.0.34 or later, we recommend that you use different levels of Kubernetes information to filter containers. The information includes pod names, namespaces, container names, and container labels.
Filter conditions Important Container labels are retrieved by running the docker inspect command. Container labels are different from Kubernetes labels. For more information, see Obtain container labels. Environment variables are the same as the environment variables that are configured to start containers. For more information, see Obtain environment variables.
Kubernetes namespaces and container names can be mapped to container labels. The label for a namespace is io.kubernetes.pod.namespace . The label for a container name is io.kubernetes.container.name . We recommend that you use the two labels to filter containers. For example, the namespace of a pod is backend-prod , and the name of a container in the pod is worker-server . If you want to collect the logs of the worker-server container, you can specify io.kubernetes.pod.namespace : backend-prod or io.kubernetes.container.name : worker-server in the container label whitelist. If the two labels do not meet your business requirements, you can use the environment variable whitelist or the environment variable blacklist to filter containers.
K8s Pod Name Regular Matching
The pod name. The pod name specifies the containers from which stdout and stderr are collected. Regular expression matching is supported. For example, if you specify ^(nginx-log-demo.*)$, , all containers in the pods whose name starts with nginx-log-demo are matched. Note Logtail V1.0.34 and later support this parameter.
K8s Namespace Regular Matching
The namespace. The namespace specifies the containers from which stdout and stderr are collected. Regular expression matching is supported. For example, if you specify ^(default|nginx)$ , all containers in the nginx and default namespaces are matched. Note Logtail V1.0.34 and later support this parameter.
K8s Container Name Regular Matching
The container name. The container name specifies the containers from which stdout and stderr are collected. Regular expression matching is supported. Kubernetes container names are defined in spec.containers. For example, if you specify ^(container-test)$ , all containers whose name is container-test are matched. Note Logtail V1.0.34 and later support this parameter.
Container Label Whitelist
The container label whitelist. The whitelist specifies the containers from which stdout and stderr are collected. This parameter is empty by default, which specifies that stdout and stderr are collected from all containers. When you configure the container label whitelist, the Label Name parameter is required, and the Label Value parameter is optional. If the LabelValue parameter is empty, containers whose container labels contain the keys specified by LabelKey are matched. If the LabelValue parameter is not empty, containers whose container labels consist of the key-value pairs specified by LabelKey and LabelValue are matched. By default, string matching is performed for the values of the LabelValue parameter. Containers are matched only if the values of the container labels are the same as the values of the LabelValue parameter. If you specify a value that starts with a caret (^ ) and ends with a dollar sign ($ ) for the LabelValue parameter, regular expression matching is performed. For example, if you set the LabelKey parameter to io.kubernetes.container.name and set the LabelValue parameter to ^(nginx|cube)$, a container named nginx and a container named cube are matched.
Key-value pairs are connected by using the OR operator. If a container has a container label that consists of one of the specified key-value pairs, the container is matched.
Container Label Blacklist
The container label blacklist. The blacklist specifies the containers from which stdout and stderr are not collected. This parameter is empty by default, which specifies that stdout and stderr are collected from all containers. When you configure the container label blacklist, the Label Name parameter is required, and the Label Value parameter is optional. If the LabelValue parameter is empty, containers whose container labels contain the keys specified by LabelKey are filtered out. If the LabelValue parameter is not empty, containers whose container labels consist of the key-value pairs specified by LabelKey and LabelValue are filtered out. By default, string matching is performed for the values of the LabelValue parameter. Containers are matched only if the values of the container labels are the same as the values of the LabelValue parameter. If you specify a value that starts with a caret (^ ) and ends with a dollar sign ($ ) for the LabelValue parameter, regular expression matching is performed. For example, if you set the LabelKey parameter to io.kubernetes.container.name and set the LabelValue parameter to ^(nginx|cube)$, a container named nginx and a container named cube are matched.
Key-value pairs are connected by using the OR operator. If a container has a container label that consists of one of the specified key-value pairs, the container is filtered out.
Environment Variable Whitelist
The environment variable whitelist. The whitelist specifies the containers from which stdout and stderr are collected. This parameter is empty by default, which specifies that stdout and stderr are collected from all containers. When you configure the environment variable whitelist, the Environment Variable Name parameter is required, and the Environment Variable Value parameter is optional. If the EnvValue parameter is empty, containers whose environment variables contain the keys specified by EnvKey are matched. If the EnvValue parameter is not empty, containers whose environment variables consist of the key-value pairs specified by EnvKey and EnvValue are matched. By default, string matching is performed for the values of the EnvValue parameter. Containers are matched only if the values of the environment variables are the same as the values of the EnvValue parameter. If you specify a value that starts with a caret (^ ) and ends with a dollar sign ($ ) for the EnvValue parameter, regular expression matching is performed. For example, if you set the EnvKey parameter to NGINX_SERVICE_PORT and set the EnvValue parameter to ^(80|6379)$, containers whose port number is 80 and containers whose port number is 6379 are matched.
Key-value pairs are connected by using the OR operator. If a container has an environment variable that consists of one of the specified key-value pairs, the container is matched.
Environment Variable Blacklist
The environment variable blacklist. The blacklist specifies the containers from which stdout and stderr are not collected. This parameter is empty by default, which specifies that stdout and stderr are collected from all containers. When you configure the environment variable blacklist, the Environment Variable Name parameter is required, and the Environment Variable Value parameter is optional. If the EnvValue parameter is empty, containers whose environment variables contain the keys specified by EnvKey are filtered out. If the EnvValue parameter is not empty, containers whose environment variables consist of the key-value pairs specified by EnvKey and EnvValue are filtered out. By default, string matching is performed for the values of the EnvValue parameter. Containers are matched only if the values of the environment variables are the same as the values of the EnvValue parameter. If you specify a value that starts with a caret (^ ) and ends with a dollar sign ($ ) for the EnvValue parameter, regular expression matching is performed. For example, if you set the EnvKey parameter to NGINX_SERVICE_PORT and set the EnvValue parameter to ^(80|6379)$, containers whose port number is 80 and containers whose port number is 6379 are matched.
Key-value pairs are connected by using the OR operator. If a container has an environment variable that consists of one of the specified key-value pairs, the container is filtered out.
Kubernetes Pod Label Whitelist
The Kubernetes label whitelist. The whitelist specifies the containers from which stdout and stderr are collected. When you configure the Kubernetes label whitelist, the Label Name parameter is required, and the Label Value parameter is optional. If the LabelValue parameter is empty, containers whose Kubernetes labels contain the keys specified by LabelKey are matched. If the LabelValue parameter is not empty, containers whose Kubernetes labels consist of the key-value pairs specified by LabelKey and LabelValue are matched. By default, string matching is performed for the values of the LabelValue parameter. Containers are matched only if the values of the Kubernetes labels are the same as the values of the LabelValue parameter. If you specify a value that starts with a caret (^ ) and ends with a dollar sign ($ ), regular expression matching is performed. For example, if you set the LabelKey parameter to app and set the LabelValue parameter to ^(test1|test2)$, containers whose Kubernetes labels consist of app:test1 or app:test2 are matched.
Key-value pairs are connected by using the OR operator. If a container has a Kubernetes label that consists of one of the specified key-value pairs, the container is matched. Note Logtail V1.0.34 and later support this parameter. If you change Kubernetes labels when Kubernetes control resources, such as Deployments, are running, the operational pod is not restarted. Therefore, the pod cannot detect the change. This may cause a matching rule to become invalid. When you configure the Kubernetes label whitelist and the Kubernetes label blacklist, we recommend that you use the Kubernetes labels of pods. For more information about Kubernetes labels, see Labels and Selectors.
Kubernetes Pod Label Blacklist
The Kubernetes label blacklist. The blacklist specifies the containers from which stdout and stderr are not collected. When you configure the Kubernetes label blacklist, the Label Name parameter is required, and the Label Value parameter is optional. If the LabelValue parameter is empty, containers whose Kubernetes labels contain the keys specified by LabelKey are filtered out. If the LabelValue parameter is not empty, containers whose Kubernetes labels consist of the key-value pairs specified by LabelKey and LabelValue are filtered out. By default, string matching is performed for the values of the LabelValue parameter. Containers are matched only if the values of the Kubernetes labels are the same as the values of the LabelValue parameter. If you specify a value that starts with a caret (^ ) and ends with a dollar sign ($ ), regular expression matching is performed. For example, if you set the LabelKey parameter to app and set the LabelValue parameter to ^(test1|test2)$, containers whose Kubernetes labels consist of app:test1 or app:test2 are matched.
Key-value pairs are connected by using the OR operator. If a container has a Kubernetes label that consists of one of the specified key-value pairs, the container is filtered out. Note Logtail V1.0.34 and later support this parameter. If you change Kubernetes labels when Kubernetes control resources, such as Deployments, are running, the operational pod is not restarted. Therefore, the pod cannot detect the change. This may cause a matching rule to become invalid. When you configure the Kubernetes label whitelist and the Kubernetes label blacklist, we recommend that you use the Kubernetes labels of pods. For more information about Kubernetes labels, see Labels and Selectors.
|
Log Tag Enrichment | If you use Logtail V1.0.34 or later, we recommend that you add environment variables or Kubernetes labels to logs as log tags.
After you configure this parameter, Simple Log Service adds environment variable-related fields to logs. For example, set the Environment Variable Name parameter to VERSION and the Tag Name parameter to env_version. If the environment variable settings of a container include VERSION=v1.0.0 , Simple Log Service adds the __tag__:__env_version__: v1.0.0 field to logs.
After you configure this parameter, Simple Log Service adds Kubernetes pod label-related fields to logs. For example, set the Pod Label Name parameter to app and the Tag Name parameter to k8s_pod_app . If the label settings of a Kubernetes cluster include app=serviceA , Simple Log Service adds the __tag__:__k8s_pod_app__: serviceA field to logs.
|
Maximum Log Length (Unit: Bytes) | The maximum size of a log. Default value: 524288. Valid values: 1024 to 20971520. If the size of a log exceeds the value of this parameter, Logtail stops matching the beginning of the first line of the next log and uploads the log to Simple Log Service. |
Maximum Length of Traced Historical Data during First Collection (Unit: Bytes) | The maximum size of historical data that can be traced the first time Logtail collects logs from a log file. The default value is 131072 bytes, which is equivalent to 128 KB. Valid values: 131072 to 1048576. |
Advanced Parameters | You must manually configure specific parameters of a Logtail configuration. For more information, see CreateLogtailPipelineConfig. |