The template format writes output from user-defined content, replacing curly-braced references with values from each event payload. It can also insert an event’s time value. section 5.5
Use these references when defining a template:
- Reference a top-level payload value with a key such as {hello}. section 5.5
- Reference nested JSON with dot notation, such as {parent.child}, using a subset of JSONPath. section 5.5
- Reference the log record’s timestamp with {time}. section 5.5
Listing 5.5 Different file formats: simple-file.conf
[SERVICE]
flush 1
log_level error
[INPUT]
name http
listen 0.0.0.0
port 9881
tag http-in
[OUTPUT] #1
match *
name stdout
json_date_key received-date
json_date_format iso8601
format json_lines
[OUTPUT]
match *
name file #2
file output1.csv #3
format csv #4
delimiter \t #5
[OUTPUT]
match *
name file
file output1.ltsv
format ltsv #6
label_delimiter space #7
delimiter comma #8
[OUTPUT]
match *
name file
file output1.txt
format plain
[OUTPUT]
match *
name file
file output1.msgpack
format msgpack #9
[OUTPUT]
match *
name file
format template #10
file output1.templated.txt
template addressing={hello} value={val} --- {time} #11
The file-output configuration combines literal text with payload references in a template and writes the result to output1.templated.txt. section 5.5
