in_tailInput plugin allows Fluentd to read events from the tail of text files. Its behavior is similar to the
in_tailis included in Fluentd's core. No additional installation process is required.
- When Fluentd is first configured with
in_tail, it will startreading from the tail of that log, not the beginning.
- Once the log is rotated, Fluentd starts reading the new file fromthe beginning. It keeps track of the current inode number.
td-agentrestarts, it starts reading from the last positiontd-agent read before the restart. This position is recorded in theposition file specified by the pos_file parameter.
The value must be
The tag of the event.
*can be used as a placeholder that expands to the actual file path, replacing '/' with '.'. For example, if you have the following configuration
in_tail emits the parsed events with the 'foo.path.to.file' tag.
The paths to read. Multiple paths can be specified, separated by ','.
*and strftime format can be included to add/remove watch file dynamically. At interval of
refresh_interval, Fluentd refreshes the list of watch file.
If the date is 20140401, Fluentd starts to watch the files in /path/to/2014/04/01 directory. See also
You should not use \'*\' with log rotation because it may cause the log duplication. In such case, you should separate in_tail plugin configuration.
The paths to exclude the files from watcher list. For example, if you want to remove compressed files, you can use following pattern.
exclude_path ["/path/to/*.gz", "/path/to/*.zip"]
The interval of refreshing the list of watch file. Default is 60 seconds.
This parameter is available since v0.12.33.
Limit the watching files that the modification time is within the specified time range when use
This parameter is available since v0.12.33.
Skip the refresh of watching list on startup. This reduces the start up time when use
Start to read the logs from the head of file, not bottom. The default is
If you want to tail all contents with
*or strftime dynamic path, set this parameter to
true. Instead, you should guarantee that log rotation will not occur in
When this is true, in_tail tries to read a file during start up phase. If target file is large, it takes long time and starting other plugins isn't executed until reading file is finished.
Specify the encoding of reading lines. The default is ASCII-8BIT.
By default, in_tail emits string value as ASCII-8BIT encoding. These options change it.
You can get supported encoding list by typing following command:
$ ruby -e 'p Encoding.name_list.sort'
The number of reading lines at each IO. Default is 1000 lines.
If you see "Size of the emitted data exceeds buffer_chunk_limit." log with in_tail, set smaller value.
The interval of flushing the buffer for multiline format. The default is disabled.
If you set
multiline_flush_interval 5s, in_tail flushes buffered event after 5 seconds from last emit. This option is useful when you use
format_firstlineoption. Since v0.12.20 or later.
This parameter is highly recommended. Fluentd will record the position it last read into this file.
pos_filehandles multiple positions in one file so no need multiple
Don't share pos_file between in_tail configurations. It causes unexpected behavior, e.g. corrupt pos_file content.
in_tail removes untracked file position during startup phase. It means the content of pos_file is growing until restart when you tails lots of files with dynamic path setting. I will fix this problem in the future. Check this issue.
Add watching file path to
With this config, generated events are like
in_tail actually does a bit more than
tail -Fitself. When rotating a file, some data may still need to be written to the old file as opposed to the new one.
in_tail takes care of this by keeping a reference to the old file (even after it has been rotated) for some time before transitioning completely to the new file. This helps prevent data designated for the old file from getting lost. By default, this time interval is 5 seconds.
The rotate_wait parameter accepts a single integer representing the number of seconds you want this time interval to be.
Enable the additional watch timer. Setting this parameter to
falsewill significantly reduce CPU and I/O consumption when tailing a large number of files on systems with inotify support. The default is
truewhich results in an additional 1 second timer being used.
in_tail(via Cool.io) uses inotify on systems which support it. Earlier versions of libev on some platforms (eg Mac OS X) did not work properly; therefore, an explicit 1 second timer was used. Even on systems with inotify support, this results in additional I/O each second, for every file being tailed.
Early testing demonstrates that modern Cool.io and
in_tailwork properly without the additional watch timer. At some point in the future, depending on feedback and testing, the additional watch timer may be disabled by default.
If you hard to exclude non-permision files from watching list, set this parameter to
true. It suppress repeated permission error logs.
log_leveloption allows the user to set different levels of logging for each plugin. The supported log levels are:
tail -Fcommand behaviour by default, so
in_tailreads only newer logs. If you want to read existing lines for batch use case, set
nocreateparameter and it doesn't create new file after triggered log rotation. It means
in_tailcan't find new file to tail.
This parameter doesn't fit typical application log cases, so check your
logrotatesetting which doesn't include
in_tail stops reading new lines and pos file update until BufferQueueLimitError is resolved. After resolved BufferQueueLimitError, restart emitting new lines and pos file update.