tencent cloud

Cloud Log Service

Configuring the Time Format

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-09 10:58:59
CLS requires a time attribute for each log so that the system can manage the data by the time dimension. When logs are collected using Loglistener, the time attribute can be configured using two methods:
Default method: use Loglistener collection time as the time attribute.
Custom method: Use a time field from the log content as the time attribute. You must configure a time parsing format, and the time field must contain a complete "year-month-day hour:minute:second" string to be parsed successfully.
Notes:
Loglistener collects time with millisecond precision. Therefore, the time parsing format can be configured to support millisecond precision. After the time format is configured, 0 will be automatically filled in if the collection time is less than one millisecond.

About Parsing Formats

Parameter Format
Description
Example
%a
Abbreviation for a day in a week.
Fri
%A
Full name for a day in a week.
Friday
%b
Abbreviation for each month.
Jan
%B
Full name for each month.
January
%d
Day in a month (01–31).
31
%h
Abbreviation for each month, which is consistent with %b.
Jan
%H
Hour in a 24-hour clock (00–23).
22
%I
Hour in a 12-hour clock (01–12).
11
%m
Month (01–12). The value 01 indicates January.
08
%M
Minute (00–59). The value 01 indicates the first minute.
59
%n
Line break
Line break
%p
Morning (AM) or afternoon (PM).
AM/PM
%r
A specific 12-hour time composition format, which is equivalent to %I:%M:%S %p.
11:59:59 AM
%R
A specific 24-hour time composition format, which is equivalent to %H:%M.
23:59
%S
Second (00–59).
59
%f
Millisecond.
0.123
%q
microsecond time
0.123123
%o
nanosecond time
0.123123123
%t
Tab character
Tab character
%y
Year digits without the century (00–99).
19
%Y
Year digits with the century. The value 2018 indicates the year 2018.
2019
%C
Century digits, which is obtained by dividing a year by 100. Value range: 00–99.
20
%e
Day in a month (01–31).
31
%j
Day in a year (001–366).
365
%u
Digital representation of a day in a week (1–7). The value 1 is for Monday and the value 7 for Sunday.
1
%U
Week in a year (00–53). Sunday is the beginning of a week. The first Sunday in a year is used as the first day of the first week.
23
%w
Digital representation of a day in a week (0–6). The value 0 is for Sunday and the value 6 for Saturday.
5
%W
Week in a year (00–53). Monday is the beginning of a week. The first Monday in a year is used as the first day of the first week.
23
%s
Second-level (10-digit) Unix timestamp. (Effective only for Loglistener versions below 3.0.)
1571394459
%F
Second-level (10-digit) Unix timestamp. (Requires Loglistener version 3.0 or above.)
Millisecond-level (13-digit) Unix timestamp (requires Loglistener version 2.6.4 or above)
1571394459123
%Q
Microsecond-level (16-digit) Unix timestamp (requires Loglistener version 2.8.4 or above)
1571394459123456
%z
Supports time zone parsing for time fields, including ISO 8601 time format and GMT time format.
UTC/+0800/MST

Configuration Samples

Time Representation Example
Time Extraction Format
2018-07-16 13:12:57.123
%Y-%m-%d %H:%M:%S.%f
[2018-07-16 13:12:57.012]
[%Y-%m-%d %H:%M:%S.%f]
06/Aug/2019 12:12:19
%d/%b/%Y %H:%M:%S
Monday, 02-Oct-19 16:07:05
%A, %d-%b-%y %H:%M:%S
1571394459123
%F
06/Aug/2019 12:12:19 +0800
%d/%b/%Y %H:%M:%S %z
Monday, 02-Oct-19 16:07:05 MST
%A, %d-%b-%y %H:%M:%S %z


도움말 및 지원

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

피드백