tencent cloud

문서Cloud Log Service

Log

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-14 21:19:40

Log

Logs are record data generated during the running of an application system, such as user operation logs, API access logs, and system error logs. Logs are usually stored in text format on the host where the application system resides. A log corresponding to a system running record may contain one line of text (single-line log) or multiple lines of text (multi-line log).
Logs can be uploaded the CLS via LogListener or other methods such as APIs or SDKs.
Example of a single-line log:
59.x.x.x - - [06/Aug/2019:12:12:19 +0800] "GET /nginx-logo.png HTTP/1.1" 200 368 "http://119.x.x.x/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" "-"
Example of a multi-line log:
java.net.SocketTimeoutException:Receive timed out
at j.n.PlainDatagramSocketImpl.receive0(Native Method)[na:1.8.0_151]
at j.n.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:143)[^]
at j.n.DatagramSocket.receive(DatagramSocket.java:812)[^]
at o.s.n.SntpClient.requestTime(SntpClient.java:213)[classes/]
at o.s.n.SntpClient$1.call(^:145)[^]
at ^.call(^:134)[^]
at o.s.f.SyncRetryExecutor.call(SyncRetryExecutor.java:124)[^]
at o.s.f.RetryPolicy.call(RetryPolicy.java:105)[^]
at o.s.f.SyncRetryExecutor.call(SyncRetryExecutor.java:59)[^]
at o.s.n.SntpClient.requestTimeHA(SntpClient.java:134)[^]
at ^.requestTimeHA(^:122)[^]
at o.s.n.SntpClientTest.test2h(SntpClientTest.java:89)[test-classes/]
at s.r.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_151]
The main components of a log are as follows:
Category
Field
Description
Example
Built-in Reserved Field
__TIMESTAMP__
Log timestamp (millisecond-level Unix timestamp), which is automatically used to search for logs and is displayed as Log Time in the console when logs are searched by time range.
1640005601188
__FILENAME__
File name for log collection.
/data/log/nginx/access.log
__SOURCE__
Source IP address for log collection.
10.0.1.2
__HOSTNAME__
Host name of the log source, which can only be collected via LogListener 2.7.4 or later.
localhost
__RAWLOG__
During log index creation, if the raw log format is abnormal or the index configuration does not match the raw log, it may cause an index creation exception. In this case, to prevent log loss, CLS stores the raw log in this field as a fallback exception handling method.
{"ip":"10.20.20.10","request":"GET /online/sample HTTP/1.1","status":200,"time":"[2018-07-16 13:12:57]"}
__INDEX_STATUS__
Reason for log index creation exception. When the value is not empty, it indicates that an exception occurred during the current log index creation. The raw log is stored in __RAWLOG__, and __INDEX_STATUS__ is the reason for the exception.
IndexPartFail:part of fields do not match the index configuration
Log body
__CONTENT__
If the log extraction mode is full text in a single line or full text in multiple lines (the entire raw log is reported without splitting), the entire log is stored in the __CONTENT__ field.
10.20.20.10;[2018-07-16 13:12:57];GET /online/sample HTTP/1.1;200
Common fields
During log collection, after logs are structured, the raw logs are stored in the key:value format.
IP: 10.20.20.10 request: GET /online/sample HTTP/1.1 status: 200 time: [2018-07-16 13:12:57]
Metadata
Metadata Field
A brief description or categorization of logs. For example, in TKE logs, the cluster or container to which a log belongs is stored in the key:value format, and the key starts with __TAG__.
__TAG__.clusterId:1skzv59c

Log group

A log group (LogGroup) is a collection of multiple logs. In the process of log upload, to increase data read/write efficiency, multiple logs can be packaged into one log group and then sent to CLS.
Logs within a log group share the same basic information (__TIMESTAMP__, __FILENAME__, __SOURCE__, __HOSTNAME__, and metadata).

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백