file
Last updated
Last updated
The out_file
Output plugin writes events to files. By default, it creates files on a daily basis (around 00:10). This means that when you first import records using the plugin, no file is created immediately.
The file will be created when the timekey
condition has been met. To change the output frequency, please modify the timekey
value.
It is included in Fluentd's core.
Please see the Configuration File article for the basic structure and syntax of the configuration file.
For <buffer>
, refer to <buffer>
Section.
@type
(required)The value must be file
.
path
string
required parameter
0.14.0
The path of the file. The actual path is path + time + ".log" by default. The path
parameter supports placeholders, so you can embed time
, tag
and record
fields in the path.
Here is an example:
See <buffer>
Section for more detail.
The path
parameter is used as <buffer>
's path
in this plugin.
Initially, you may see a file which looks like /path/to/file.%Y%m%d/buffer.b5692238db04045286097f56f361028db.log
. This is an intermediate buffer file (b5692238db04045286097f56f361028db
identifies the buffer). Once the content of the buffer has been completely flushed, you will see the output file without the trailing identifier.
append
bool
false
0.14.0
Determines whether the flushed chunk is appended to an existing file or not. The default is not appended. By default, out_file
flushes each chunk to a different path.
This makes parallel file processing easy. But if you want to disable this behavior, you can disable it by setting append true
.
<format>
DirectiveThe format of the file content. The default @type
is out_file
.
JSON example:
See formatter
article for more detail.
format
Deprecated parameter. Use <format>
instead.
<inject>
SectionAdd event time
and event tag
to record.
See Inject Section Configurations for more details.
<buffer>
SectionSee Buffer Section Configurations for more details.
@type
string
file
0.14.9
Overwrites the default value in this plugin.
chunk_keys
array
time
0.14.9
Overwrites the default value in this plugin.
timekey
time
86400
0.14.9
Overwrites the default value in this plugin.
utc
Deprecated parameter. Use timekey_use_utc
in <buffer>
instead.
add_path_suffix
bool
true
0.14.9
Add path suffix or not. See also the path_suffix
parameter.
path_suffix
string
".log"
0.14.9
The suffix for output result.
compress
Compresses flushed files using gzip
. No compression is performed by default.
recompress
Performs compression again even if the buffer chunk is already compressed.
Default: false
symlink_path
Creates symlink to temporary buffered file when buffer_type
is file
. No symlink is created by default. This is useful for tailing file content to check logs.
This is disabled on Windows.
@log_level
The @log_level
option allows the user to set different levels of logging for each plugin.
Supported log levels: fatal
, error
, warn
, info
, debug
, trace
Please see the logging article for further details.
For common output / buffer parameters, please check the following articles:
You see an intermediate buffer file, not the output result. The placeholders are replaced during flush buffers.
For example, if you have this setting:
You see following buffer files first:
After flushed, you see actual output result:
See the path
parameter.
symlink_path
?Since Fluentd v1.4.0, you can use the placeholder syntax in symlink_path
parameter.
For example, suppose you have the following configuration:
This produces the following directory layout:
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.