file
Writes messages to files on disk based on a chosen codec.
Messages can be written to different files by using interpolation functions in the path field. However, only one file is ever open at a given time, and therefore when the path changes the previously open file is closed.
-
Common
-
Advanced
output:
label: ""
file:
path: "" # No default (required)
codec: lines
output:
label: ""
file:
path: "" # No default (required)
codec: lines
Fields
codec
The way in which the bytes of messages are written to the file. With the delim:x codec, each message is followed by the custom delimiter x, which can be any character sequence. A delimiter is not added to a message that already ends with it.
Requires version 3.33.0 or later.
Type: string
Default: lines
| Option | Summary |
|---|---|
|
Only applicable to file based outputs. Writes each message to a file in full, if the file already exists the old content is deleted. |
|
Append each message to the output stream without any delimiter or special encoding. |
|
Append each message to the output stream followed by a custom delimiter. |
|
Append each message to the output stream followed by a line break. |
# Examples:
codec: lines
# ---
codec: "delim:\t"
# ---
codec: delim:foobar
path
The file to write to, if the file does not yet exist it will be created.
This field supports interpolation functions.
Requires version 3.33.0 or later.
Type: string
# Examples:
path: /tmp/data.txt
# ---
path: /tmp/${! timestamp_unix() }.txt
# ---
path: /tmp/${! json("document.id") }.json