The inject section can be under <match>
or <filter>
section. It is enabled for the plugins that support injecting values to the event record.
<match>
@type file
# ...
<inject>
# ...
</inject>
</match>
Configuration:
<inject>
time_key fluentd_time
time_type string
time_format %Y-%m-%dT%H:%M:%S.%NZ
tag_key fluentd_tag
</inject>
Event Record:
tag: test
time: 1547575563.952259
record: {"message":"hello"}
Injected Record:
{"message":"hello","fluentd_tag":"test","fluentd_time":"2019-01-15T18:06:03.952259000Z"}
-
hostname_key
(string) (optional): the field name to injecthostname
- Default:
nil
- Default:
-
hostname
(string) (optional): hostname value- Default:
Socket.gethostname
- Default:
-
worker_id_key
(string) (optional): the field name to injectworker_id
- Default:
nil
- Default:
-
tag_key
(string) (optional): the field name to injecttag
- Default:
nil
- Default:
-
time_key
(string) (optional): the field name to injecttime
- Default:
nil
- Default:
-
time_type
(enum) (optional): parses/formats value according to thistype
- Default:
float
- Available values:
-
float
: seconds from Epoch + microseconds (e.g.1510544836.154709)
-
unixtime
: seconds from Epoch (e.g. 1510544836) -
unixtime_millis
(since v1.11.4): milliseconds from Epoch(e.g. 1510544836154)
-
unixtime_micros
(since v1.20.0): microseconds from Epoch(e.g. 1510544836154709)
-
unixtime_nanos
(since v1.20.0): nanoseconds from Epoch(e.g. 1510544836154709804)
-
string
: use format specified bytime_format
, local time or timezone
-
- Default:
-
time_format
(string) (optional): processes value according to thespecified format. This is available only when
time_type
isstring
.- Default:
nil
- Available time format:
-
For more details about formatting, see
-
For more details about parsing, see
-
%iso8601
(only for parsing) -
Use
%N
to parse/format with sub-second precision, becausestrptime
does not support%3N
,%6N
,%9N
, and%L
.
-
- Default:
-
localtime
(bool) (optional): iftrue
, uses local time. Otherwise,UTC is used. This is exclusive with
utc
.- Default:
true
- Default:
-
utc
(bool) (optional): iftrue
, uses UTC. Otherwise, local time isused. This is exclusive with
localtime
.- Default:
false
- Default:
-
timezone
(string) (optional): uses the specified timezone. One canparse/format the time value in the specified timezone format.
- Default:
nil
- Available time zone format:
[+-]HH:MM
(e.g. "+09:00") (recommended)[+-]HHMM
(e.g. "+0900")[+-]HH
(e.g. "+09")- Region/Zone (e.g.
Asia/Tokyo
) - Region/Zone/Zone (e.g.
America/Argentina/Buenos_Aires
)
- Default:
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.