timestamp パーサを実行してもフィールドは生成されず、入力が文字列から、1970 年 1 月 1 日(深夜、UTC/GMT)からの経過時間(ミリ秒)で表示された内部タイムスタンプ形式に変換されます。

サポートされている構成オプションは format のみです。たとえば、 format=%Y-%m-%d %H:%M:%S など。

CLF パーサとは異なり、timestamp パーサは %A%B%d%H%M%S%Y%z などの時刻指定子間に区切り文字のない時刻を解析します。

timestamp パーサが使用するフォーマット指定子は、以下のとおりです。

'%a':    Abbreviated weekday name, for example: Thu
'%A':    Full weekday name, for example: Thursday
'%b':    Abbreviated month name, for example: Aug
'%B':    Full month name, for example: August
'%d':    Day of the month, for example: 23. strftime() expects zero-padded (01-31) digits
         for this specifier but Log Insight agents can parse space-padded and non-padded 
         day numbers, too. 
'%e':    Day of the month, for example: 13. strftime() expects space-padded ( 1-31) digits 
         for this specifier but Log Insight agents can parse zero-padded and non-padded 
         day numbers too. 
'%f':    Fractional seconds of time, for example: .036 'f' specifier assumes that '.' or ',' 
         character should exist before fractional seconds and there is no need to mention 
         that character in the format. If none of these characters precedes fractional seconds, 
         timestamp wouldn't be parsed.
'%H':    Hour in 24h format (00-23), for example: 14. Zero-padded, space-padded, and non-padded hours 
         are supported.
'%I':    Hour in 12h format (01-12), for example: 02. Zero-padded, space-padded and non-padded hours 
         are supported.
'%m':    Month as a decimal number (01-12), for example: 08. Zero-padded, space-padded 
         and non-padded month numbers are supported.
'%M':    Minute (00-59), for example: 55
'%p':    AM or PM designation, for example: PM
'%S':    Second (00-61), for example: 02
'%s':    Total number of seconds from the UNIX epoch start, for example 1457940799 
         (represents '2016-03-14T07:33:19' timestamp)
'%Y':    Year, for example: 2001
'%z':    ISO 8601 offset from UTC in timezone (1 minute=1, 1 hour=100)., for example: +100

タイムスタンプ パーサは追加の指定子を受け取りますが、その値は無視され、解析される時刻には影響しません。

'%C':    Year divided by 100 and truncated to integer (00-99), for example: 20
'%g':    Week-based year, last two digits (00-99), for example, 01
'%G':    Week-based year, for example, 2001
'%j':    Day of the year (001-366), for example: 235
'%u':    ISO 8601 weekday as number with Monday as 1 (1-7), for example: 4
'%U':    Week number with the first Sunday as the first day of week one (00-53), for example: 33
'%V':    ISO 8601 week number (00-53), for example: 34
'%w':    Weekday as a decimal number with Sunday as 0 (0-6), for example: 4
'%W':    Week number with the first Monday as the first day of week one (00-53), for example: 34
'%y':    Year, last two digits (00-99), for example: 01

format パラメータが定義されていないと、Timestamp パーサはデフォルトのフォーマットを使用してタイムスタンプを解析します。

自動タイムスタンプ パーサ

自動タイムスタンプ パーサは、タイム スタンプ パーサの形式が定義されていない場合に呼び出されます。また、 field_decodertimestamp を使用して、タイムスタンプ パーサ定義なしで直接パーサを呼び出すことができます。例:
[parser|mycsv]
base_parser=csv
debug=yes
fields=timestamp,action,source_id,dest
field_decoder={"timestamp": "timestamp"}

デフォルト構成のタイムスタンプ パーサ

次の例に、デフォルト構成の timestamp パーサを示します。

[parser|tsp_parser]
base_parser=timestamp
debug=no
format=%Y-%m-%d %H:%M:%S%f

timestamp パーサを CSV パーサなどの他のパーサと統合するには、以下の構成を指定します。

[parser|mycsv]
base_parser=csv 
fields=timestamp,action,source_id,dest
field_decoder={"timestamp": "tsp_parser"}

この構成が指定されていると、mycsv パーサは構成で指定された名前を持つフィールドを抽出し、timestamp フィールドの内容に tsp_parser を実行します。tsp_parser が有効なタイムスタンプを取得すると、サーバはそのタイムスタンプをログ メッセージに使用します。