CLS_HOST) of the region of your log topic.
For details of the CLS domain name list, see Available Regions.wget command to download the LogConfig.yaml CRD declaration file, using the master node path /usr/local/ as an example.wget https://mirrors.tencent.com/install/cls/k8s/LogConfig.yaml
LogConfig.yaml declaration file consists of the following two parts:clsDetail: The configuration for shipping to CLS.inputDetail: Log source configuration.apiVersion: cls.cloud.tencent.com/v1kind: LogConfig ## Default valuemetadata:name: test ## CRD resource name, which is unique in the cluster.spec:clsDetail: ## The configuration for shipping to CLS...inputDetail: ## Log source configuration...
clsDetail:# You need to specify the logset and topic names to automatically create a log topic, which cannot be modified after being defined.logsetName: test ## The name of the CLS logset. If there is no logset with this name, one will be created automatically. If there is such a logset, a log topic will be created under it.topicName: test ## The name of the CLS log topic. If there is no log topic with this name, one will be created automatically.# Select an existing logset and log topic. If the logset is specified but the log topic is not, a log topic will be created automatically, which cannot be modified after being defined.logsetId: xxxxxx-xx-xx-xx-xxxxxxxx ## The ID of the CLS logset. The logset needs to be created in advance in CLS.topicId: xxxxxx-xx-xx-xx-xxxxxxxx ## The ID of the CLS log topic. The log topic needs to be created in advance in CLS and not occupied by other collection configurations.# Define the log topic configuration when a log topic is created automatically. The configuration cannot be modified after being defined.period: 30 ## Optional. Lifetime, in days. Valid value range: 1~3600. For STANDARD_IA storage, the valid range is 7~3600 days. A value of 3640 indicates permanent retention.storageType: hot ## Optional. The storage type for the log topic. Valid values: hot (STANDARD storage), cold (STANDARD_IA storage). Default value: hot.hotPeriod: 7 ## Optional. Transition period, in days. Valid value range: 7~3600. This parameter takes effect only when storageType is hot. The value of hotPeriod must be greater than that of period. The transition period is calculated as Period-hotPeriod.partitionCount: 1 ## Optional. The number of partitions for the log topic. One partition is created by default. Up to 10 partitions can be created.autoSplit: "true" ## Optional. Whether to enable auto-splitting. Default value: true. The value must be enclosed in double quotation marks ("").maxSplitPartitions: 50 ## Optional. The maximum number of splits after auto-splitting is enabled. Default value: 50.tags: ## Optional. A list of Tag descriptions. By specifying this parameter, you can bind Tags to the corresponding log topic. Up to 9 Tag key-value pairs are supported. A resource can be bound to only one Tag key.- key: xxx ## Tag keyvalue: xxx ## Tag value### Define Collection RuleslogType: json_log ## Log parsing format. `json_log` indicates json format, `delimiter_log` indicates delimiter format, `minimalist_log` indicates single-line full-text format, `multiline_log` indicates multi-line full-text format, `fullregex_log` indicates single-line full regex format, `multiline_fullregex_log` indicates multi-line full regex format, and `user_define_log` indicates Combined parsing. Default value: minimalist_log.excludePaths: ## Optional. A list of collection blocklist paths. This parameter is valid only when `inputDetail` is `containerFile` or `hostFile`.- type: File ## Type. Optional. Valid values: File or Path.value: /xx/xx/xx/xx.log ## The value corresponding to `type`.userDefineRule: xxxxxx ## Optional. Custom collection rules, serialized Json string.### Extraction and Filtering RulesextractRule: ## Optional. Extraction and filtering rules. If `ExtractRule` is set, `LogType` must also be set. For details, see the description of the `extractRule` object.timeKey: xxx ## The key name of the time field. `time_key` and `time_format` must be used together.timeFormat: xxx ## The format of the time field. Refer to the format specifiers for time in the c language's `strftime` function for output parameters.delimiter: xxx ## The delimiter for delimiter-type logs. This parameter is valid only when `log_type` is `delimiter_log`.logRegex: xxx ## The rule for matching the entire log. This parameter is valid only when `log_type` is `fullregex_log`.beginningRegex: xxx ## The line-start regular expression matching rule. This parameter is valid only when `log_type` is `multiline_log` or `fullregex_log`.keys: ## The key name for each field. A key left empty indicates that the field is to be discarded. This parameter is valid only when `log_type` is `delimiter_log`.- a- bfilterKeys: ## Must correspond to `filterRegex`. `filterKeys` is an array that specifies the keys of the logs to be filtered.- a- bfilterRegex: ## Must correspond to `filterKeys`. `filterRegex` is an array of regular expression strings, representing the filtering rules regex corresponding to the keys.- aRegx- bRegxadvancedFilters: ## Advanced filtering rules. This field is applicable only to collector component versions v1.1.15 and above. For versions below v1.1.15, use `filterKeys` and `filterRegex`.- key: level ## The key to be filteredrule: 0 ## Filtering rule. Supported numeric enumerations are: 0 (equals), 1 (field exists), 2 (field does not exist), 3 (not equals).value: info ## The value to be filtered. When `rule` is 1 or 2, `value` does not need to be specified.unMatchUpload: "false" ## Whether to upload logs that fail to parse. `true` indicates upload, `false` indicates no upload. The default is no upload.unMatchedKey: "parseFailed" ## The key name for uploading logs that fail to parse to CLS.backtracking: "-1" ## "-1" or "0". "-1" indicates full collection, "0" indicates incremental collection. Any number greater than 0 indicates the amount of data to be backtracked in incremental collection mode. Full collection is the default.isGBK: "true" ## "true" or "false". Default value: "false".jsonStandard: "true" ## "true" or "false". Default value: "true".### Advanced Collection ConfigurationadvancedConfig: ## OptionalClsAgentMaxDepth: 1 ## The maximum directory depth for the collector to scan. The value must be an integer greater than or equal to 0. A value of 0 indicates the current directory.ClsAgentFileTimeout: 60 ## The file timeout attribute. If a log file has not been modified for longer than the specified time, the collector stops monitoring it. This parameter must be an integer greater than or equal to 0, in seconds. A value of 0 indicates no timeout, meaning all files are collected.ClsAgentParseFailMerge: true ## Merge logs that fail to parse. Valid values: true or false.### Customize Full-Text Index When Creating a topic### This feature is supported only when a log topic is created automatically. It does not support modifying the index of an existing log topic.fullTextIndex: ## Optional. Full-text index settings.status: "on" ## The full-text index switch. If not set, the full-text index is enabled by default. If set to "on" (enabled) and other parameters are not set, caseSensitive and tokenizer will use their default values. If set to "off" (disabled), the full-text index is not enabled.tokenizer: "@&()='\\",;:<>[]{}/ \\n\\t\\r" ## The delimiter for full-text indexing. If the full-text index switch is enabled, you must set tokenizer. It can be set to "@&()='\\",;:<>[]{}/ \\n\\t\\r", which is the default setting.caseSensitive: false ## Whether case-sensitivecontainZH: false ## Whether to include Chinese### Customize TAG and Key-Value Index Settings When Creating a topicindexStatus: "on" ## Optional. The switch for TAG and key-value indexing. If not set, the system creates three TAG indexes (pod_name/namespace/container_name) by default. A value of "off" indicates that key-value indexing is not configured.autoIndex: "off" ## Optional. A value of "off" indicates that automatic index configuration is not set. A value of "on" indicates that automatic index configuration is enabled.indexs: ## Optional.- indexName: xxx ## The field for which you need to configure key-value indexing or TAG indexing. The eight metadata fields related to Pods (namespace/pod_name/pod_ip/pod_uid/container_id/container_name/image_name/cluster_id) and fields with the pod_label_ prefix are set as TAG indexes. Other fields are set as key-value indexes.indexType: "text" ## Optional. The field type. Currently supported types are: long, text, double. Optional.tokenizer: "@&()='\\",;:<>[]{}/ \\n\\t\\r" ## Optional. The delimiter for the field. Each character in the string represents a delimiter. Only English symbols and \\n\\t\\r are supported. For fields of type long or double, this value must be left empty.## For fields of type text, it is recommended to use @&?|#()='\\",;:<>[]{}/ \\n\\t\\r\\ as the delimiter.sqlFlag: true ## Optional. Whether to enable the analysis feature for the field. true/false indicates whether to enable the analysis feature. If the log topic is a STANDARD_IA log topic, the sqlFlag option cannot be enabled.containZH: false ## Optional. Whether to include Chinese.
Tue Jan 22 12:08:15 CST 2019 Installed: libjpeg-turbo-static-1.2.90-6.el7.x86_64
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:clsDetail:topicId: xxxxxx-xx-xx-xx-xxxxxxxx# Single-line LoglogType: minimalist_log
__CONTENT__:Tue Jan 22 12:08:15 CST 2019 Installed: libjpeg-turbo-static-1.2.90-6.el7.x86_64
2019-12-15 17:13:06,043 [main] ERROR com.test.logging.FooFactory:java.lang.NullPointerExceptionat com.test.logging.FooFactory.createFoo(FooFactory.java:15)at com.test.logging.FooFactoryTest.test(FooFactoryTest.java:11)
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:clsDetail:topicId: xxxxxx-xx-xx-xx-xxxxxxxx# Multi-line LoglogType: multiline_logextractRule:# Only a line that begins with a date and time is recognized as the start of a new log entry. Otherwise, a newline character \\n is appended to the current log entry.beginningRegex: \\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2},\\d{3}\\s.+
__CONTENT__:2019-12-15 17:13:06,043 [main] ERROR com.test.logging.FooFactory:\\njava.lang.NullPointerException\\n at com.test.logging.FooFactory.createFoo(FooFactory.java:15)\\n at com.test.logging.FooFactoryTest.test(FooFactoryTest.java:11)
10.135.46.111 - - [22/Jan/2019:19:19:30 +0800] "GET /my/course/1 HTTP/1.1" 127.0.0.1 200 782 9703 "http://127.0.0.1/course/explore?filter%5Btype%5D=all&filter%5Bprice%5D=all&filter%5BcurrentLevelId%5D=all&orderBy=studentNum" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0" 0.354 0.354
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:clsDetail:topicId: xxxxxx-xx-xx-xx-xxxxxxxx# Full Regular Expression FormatlogType: fullregex_logextractRule:# Regular Expression: Values are extracted based on the () capture groups.logRegex: (\\S+)[^\\[]+(\\[[^:]+:\\d+:\\d+:\\d+\\s\\S+)\\s"(\\w+)\\s(\\S+)\\s([^"]+)"\\s(\\S+)\\s(\\d+)\\s(\\d+)\\s(\\d+)\\s"([^"]+)"\\s"([^"]+)"\\s+(\\S+)\\s(\\S+).*beginningRegex: (\\S+)[^\\[]+(\\[[^:]+:\\d+:\\d+:\\d+\\s\\S+)\\s"(\\w+)\\s(\\S+)\\s([^"]+)"\\s(\\S+)\\s(\\d+)\\s(\\d+)\\s(\\d+)\\s"([^"]+)"\\s"([^"]+)"\\s+(\\S+)\\s(\\S+).*# List of extracted keys, which correspond one-to-one with the extracted values.keys: ['remote_addr','time_local','request_method','request_url','http_protocol','http_host','status','request_length','body_bytes_sent','http_referer','http_user_agent','request_time','upstream_response_time']
body_bytes_sent: 9703http_host: 127.0.0.1http_protocol: HTTP/1.1http_referer: http://127.0.0.1/course/explore?filter%5Btype%5D=all&filter%5Bprice%5D=all&filter%5BcurrentLevelId%5D=all&orderBy=studentNumhttp_user_agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0remote_addr: 10.135.46.111request_length: 782request_method: GETrequest_time: 0.354request_url: /my/course/1status: 200time_local: [22/Jan/2019:19:19:30 +0800]upstream_response_time: 0.354
[2018-10-01T10:30:01,000] [INFO] java.lang.Exception: exception happenedat TestPrintStackTrace.f(TestPrintStackTrace.java:3)at TestPrintStackTrace.g(TestPrintStackTrace.java:7)at TestPrintStackTrace.main(TestPrintStackTrace.java:16)
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:clsDetail:topicId: xxxxxx-xx-xx-xx-xxxxxxxx# Multi-line Full Regular Expression FormatlogType: multiline_fullregex_logextractRule:# Full Regular Expression at Line Start: Only a line that begins with a date and time is recognized as the start of a new log entry. Otherwise, a newline character \\n is appended to the current log entry.beginningRegex: \\[\\d+-\\d+-\\w+:\\d+:\\d+,\\d+\\]\\s\\[\\w+\\]\\s.*# Regular Expression: Values are extracted based on the () capture groups.logRegex: \\[(\\d+-\\d+-\\w+:\\d+:\\d+,\\d+)\\]\\s\\[(\\w+)\\]\\s(.*)# List of extracted keys, which correspond one-to-one with the extracted values.keys: ['time','level','msg']
time: 2018-10-01T10:30:01,000`level: INFO`msg:java.lang.Exception: exception happenedat TestPrintStackTrace.f(TestPrintStackTrace.java:3)at TestPrintStackTrace.g(TestPrintStackTrace.java:7)at TestPrintStackTrace.main(TestPrintStackTrace.java:16)
{"remote_ip":"10.135.46.111","time_local":"22/Jan/2019:19:19:34 +0800","body_sent":23,"responsetime":0.232,"upstreamtime":"0.232","upstreamhost":"unix:/tmp/php-cgi.sock","http_host":"127.0.0.1","method":"POST","url":"/event/dispatch","request":"POST /event/dispatch HTTP/1.1","xff":"-","referer":"http://127.0.0.1/my/course/4","agent":"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0","response_code":"200"}
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:clsDetail:topicId: xxxxxx-xx-xx-xx-xxxxxxxx# JSON Format LogslogType: json_log
agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0body_sent: 23http_host: 127.0.0.1method: POSTreferer: http://127.0.0.1/my/course/4remote_ip: 10.135.46.111request: POST /event/dispatch HTTP/1.1response_code: 200responsetime: 0.232time_local: 22/Jan/2019:19:19:34 +0800upstreamhost: unix:/tmp/php-cgi.sockupstreamtime: 0.232url: /event/dispatchxff: -
10.20.20.10 ::: [Tue Jan 22 14:49:45 CST 2019 +0800] ::: GET /online/sample HTTP/1.1 ::: 127.0.0.1 ::: 200 ::: 647 ::: 35 ::: http://127.0.0.1/
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:clsDetail:topicId: xxxxxx-xx-xx-xx-xxxxxxxx# Separator loglogType: delimiter_logextractRule:# Separatordelimiter: ':::'# List of extracted keys, which correspond one-to-one with the split fields.keys: ['IP','time','request','host','status','length','bytes','referer']
IP: 10.20.20.10bytes: 35host: 127.0.0.1length: 647referer: http://127.0.0.1/request: GET /online/sample HTTP/1.1status: 200time: [Tue Jan 22 14:49:45 CST 2019 +0800]
1571394459,http://127.0.0.1/my/course/4|10.135.46.111|200,status:DEAD,
{"processors": [{"type": "processor_split_delimiter","detail": {"Delimiter": ",","ExtractKeys": [ "time", "msg1","msg2"]},"processors": [{"type": "processor_timeformat","detail": {"KeepSource": true,"TimeFormat": "%s","SourceKey": "time"}},{"type": "processor_split_delimiter","detail": {"KeepSource": false,"Delimiter": "|","SourceKey": "msg1","ExtractKeys": [ "submsg1","submsg2","submsg3"]},"processors": []},{"type": "processor_split_key_value","detail": {"KeepSource": false,"Delimiter": ":","SourceKey": "msg2"}}]}]}
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:clsDetail:topicId: xxxxxx-xx-xx-xx-xxxxxxxx# Separator loglogType: delimiter_loguserDefineRule:"{ \\"processors\\": [ { \\"type\\": \\"processor_split_delimiter\\", \\"detail\\": { \\"Delimiter\\": \\",\\", \\"ExtractKeys\\": [ \\"time\\", \\"msg1\\",\\"msg2\\"] }, \\"processors\\": [ { \\"type\\": \\"processor_timeformat\\", \\"detail\\": { \\"KeepSource\\": true, \\"TimeFormat\\": \\"%s\\", \\"SourceKey\\": \\"time\\" } }, { \\"type\\": \\"processor_split_delimiter\\", \\"detail\\": { \\"KeepSource\\": false, \\"Delimiter\\": \\"|\\", \\"SourceKey\\": \\"msg1\\", \\"ExtractKeys\\": [ \\"submsg1\\",\\"submsg2\\",\\"submsg3\\"] }, \\"processors\\": [] }, { \\"type\\": \\"processor_split_key_value\\", \\"detail\\": { \\"KeepSource\\": false, \\"Delimiter\\": \\":\\", \\"SourceKey\\": \\"msg2\\" } } ] } ] }"
time: [Tue Jan 22 14:49:45 CST 2019 +0800]referer: http://127.0.0.1/my/course/4remote_ip: 10.135.46.111response_code: 200status: 200
inputDetail:type: container_stdout ## Log collection type. Valid values: `container_stdout` (container standard output); `container_file` (container file); `host_file` (host file).containerStdout: ## Container standard output configuration, which is valid only if `type` is `container_stdout`.namespace: default ## The Kubernetes namespace of the container to be collected. Separate multiple namespaces by `,`, for example, `default,namespace`. If this field is not specified, it indicates all namespaces. Note that this field cannot be specified if `excludeNamespace` is specified.excludeNamespace: nm1,nm2 ## The Kubernetes namespace of the container to be excluded. Separate multiple namespaces by `,`, for example, `nm1,nm2`. If this field is not specified, it indicates all namespaces. Note that this field cannot be specified if `namespace` is specified.nsLabelSelector: environment in (production),tier in (frontend) ## The namespace label for filtering namespacesallContainers: false ## Whether to collect the standard output of all containers in the specified namespace. Note that if `allContainers=true`, you cannot specify `workload`, `includeLabels`, and `excludeLabels` at the same time.containerOperator: in ## Container selection method. Valid values: `in` (include); `not in` (exclude).container: xxx ## The name of the container to be or not to be collectedincludeLabels: ## Pods with the specified labels will be collected. This field cannot be specified if `workload` is specified.key: value1 ## Pods with multiple values of the same key can be matched. For example, if you enter `environment = production,qa`, Pods with the `production` or `qa` value of the `environment` key will be matched. Separate multiple values by comma. If `excludeLabels` is also specified, Pods in the intersection will be matched.excludeLabels: ## The labels of the Pods to be excluded. This field cannot be specified if `workload`, `namespace`, and `excludeNamespace` are specified.key2: value2 ## Pods with multiple values of the same key can be matched. For example, if you enter `environment = production,qa`, Pods with the `production` or `qa` value of the `environment` key will be excluded. Separate multiple values by comma. If `includeLabels` is also specified, Pods in the intersection will be matched.metadataLabels: ## The Pod labels to be collected as metadata. If this field is not specified, all Pod labels will be collected as metadata.- label1metadataContainer: ## The container environments of the metadata to be collected. If this field is not specified, metadata (`namespace`, `pod_name`, `pod_ip`, `pod_uid`, `container_id`, `container_name`, and `image_name`) of all container environments will be collected.- namespacecustomLabels: ## Custom metadatalabel: l1workloads: ## The workloads of the specified workload types in the specified namespaces of the containers of the logs to be collected- container: xxx ## The name of the container to be collected. If this field is not specified, all containers in the workload Pod will be collected.containerOperator: in ## Container selection method. Valid values: `in` (include); `not in` (exclude).kind: deployment ## Workload type. Valid values: `deployment`, `daemonset`, `statefulset`, `job`, `cronjob`.name: sample-app ## Workload namenamespace: prod ## Workload namespacecontainerFile: ## Container file configuration, which is valid only if `type` is `container_file`.namespace: default ## The Kubernetes namespace of the container to be collected. You must specify a namespace.excludeNamespace: nm1,nm2 ## The Kubernetes namespace of the container to be excluded. Separate multiple namespaces by `,`, for example, `nm1,nm2`. If this field is not specified, it indicates all namespaces. Note that this field cannot be specified if `namespace` is specified.nsLabelSelector: environment in (production),tier in (frontend) ## The namespace label for filtering namespacescontainerOperator: in ## container selection method. Valid values: `in` (include); `not in` (exclude).container: xxx ## The name of the container to be or not to be collected. Multiple names are supported and must be separated by commas. If `containerOperator` is `in`, you can enter `*` to collect logs from all containers. If a workload type and name are specified, you can define the container name within that specific workload here.logPath: /var/logs ## Log folder. Wildcards are not supported.filePattern: app_*.log ## Log filename. Wildcards `*` and `?` are supported. `*` indicates to match any number of characters, while `?` indicates to match any single character.filePaths: /var/log/app1.log,/var/log/app2.log ## Specifies multiple log paths and files within the container. This parameter is incompatible with `logPath` and `filePattern`. You can specify only `filePaths` or (`logPath` and `filePattern`).metadataLabels: ## The Pod labels to be collected as metadata. If this field is not specified, all Pod labels will be collected as metadata.filePaths:- file: /var/logs ## Log folder. Wildcards `*` and `?` are supported. `*` indicates to match any number of characters, while `?` indicates to match any single character.path: app_*.log ## Log filename. Wildcards `*` and `?` are supported. `*` indicates to match any number of characters, while `?` indicates to match any single character.- file: /var/logs1path: app_*.logincludeLabels: ## Pods with the specified labels will be collected. This field cannot be specified if `workload` is specified.key: value1 ## Logs collected by the collection rule will be attached with metadata and reported to the consumer. Pods with multiple values of the same key can be matched. For example, if you enter `environment = production,qa`, Pods with the `production` or `qa` value of the `environment` key will be matched. Separate multiple values by comma. If `excludeLabels` is also specified, Pods in the intersection will be matched.excludeLabels: ## Pods with the specified labels will be excluded. This field cannot be specified if `workload` is specified.key2: value2 ## Pods with multiple values of the same key can be matched. For example, if you enter `environment = production,qa`, Pods with the `production` or `qa` value of the `environment` key will be excluded. Separate multiple values by comma. If `includeLabels` is also specified, Pods in the intersection will be matched.metadataLabels: ## The Pod labels to be collected as metadata. If this field is not specified, all Pod labels will be collected as metadata.- namespacemetadataContainer: ## The container environments of the metadata to be collected. If this field is not specified, metadata (`namespace`, `pod_name`, `pod_ip`, `pod_uid`, `container_id`, `container_name`, and `image_name`) of all container environments will be collected.customLabels: ## Custom metadatakey: valueworkload:kind: deployment ## Workload type. Valid values: `deployment`, `daemonset`, `statefulset`, `job`, `cronjob`.name: sample-app ## Workload namenamespace: prod ## Workload namespacehostFile: ## Node file path, which is valid only if `type` is `host_file`.filePattern: '*.log' ## Log filename. Wildcards `*` and `?` are supported. `*` indicates to match any number of characters, while `?` indicates to match any single character.logPath: /tmp/logs ## Log folder. Wildcards are not supported.filePaths: /var/log/app1.log,/var/log/app2.log ## Specifies multiple log paths and files within the container. This parameter is incompatible with `logPath` and `filePattern`. You can specify only `filePaths` or (`logPath` and `filePattern`).metadataLabels: ## The Pod labels to be collected as metadata. If this field is not specified, all Pod labels will be collected as metadata.filePaths:- file: /var/logs ## Log folder. Wildcards `*` and `?` are supported. `*` indicates to match any number of characters, while `?` indicates to match any single character.path: app_*.log ## Log filename. Wildcards `*` and `?` are supported. `*` indicates to match any number of characters, while `?` indicates to match any single character.- file: /var/logs1path: app_*.logcustomLabels: ## Custom metadatalabel1: v1
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:inputDetail:type: container_filecontainerFile:namespace: defaultallContainers: true...
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigspec:inputDetail:type: container_filecontainerFile:allContainers: falseworkloads:- namespace: productionname: ingress-gatewaykind: deployment...
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigspec:inputDetail:type: container_filecontainerFile:namespace: productionallContainers: falseincludeLabels:k8s-app: nginx...
apiVersion: cls.cloud.tencent.com/v1kind: LogConfigspec:inputDetail:type: container_filecontainerFile:allContainers: falsecontainerOperator: incontainer: xxx ## The name of the container to be collected. If this field is not specified, all containers in the workload Pod will be collected.workloads:- namespace: productionname: ingress-gatewaykind: deployment...
access.log file in the /data/nginx/log/ path in the NGINX container in the Pod that belongs to ingress-gateway deployment in the production namespaceapiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:inputDetail:type: container_filecontainerFile:namespace: productionworkload:name: ingress-gatewaykind: deploymentcontainer: nginxfilePaths:filePattern: access.loglogPath: /data/nginx/log...
access.log file in the /data/nginx/log/ path in the NGINX container in the Pod whose pod labels contain "k8s-app=ingress-gateway" in the production namespaceapiVersion: cls.cloud.tencent.com/v1kind: LogConfigspec:inputDetail:type: container_filecontainerFile:namespace: productionincludeLabels:k8s-app: ingress-gatewaycontainer: nginxfilePaths:filePattern: access.loglogPath: /data/nginx/log...
.log files in the host path /data/apiVersion: cls.cloud.tencent.com/v1kind: LogConfigmetadata:name: test ## The name of the collection configuration.spec:inputDetail:type: host_filehostFile:logPath: /datafilePattern: *.log...
LogConfig.yaml declaration file is defined in Step 2. Define the LogConfig object, you can run the kubectl command to create a LogConfig object based on the file.kubectl create -f /usr/local/LogConfig.yaml
kubectl get logconfig
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback