TailFile
Описание
"Следит" за файлом или списком файлов, получая данные из файла по мере их записи. Ожидается, что файл будет текстовым. Данные считываются только при обнаружении новой строки (возврат каретки или символ новой строки, либо их комбинация). Если файл периодически "перекатывается", как обычно бывает с лог-файлами, может быть использован необязательный шаблон имени перекатывания для извлечения данных из файлов, которые были перекатаны, даже если перекатывание произошло, пока NiFi не работал (при условии, что данные все еще существуют при перезапуске NiFi). Рекомендуется установить расписание запуска на несколько секунд, вместо использования значения по умолчанию в 0 секунд, так как этот процессор потребляет много ресурсов при агрессивном расписании. В настоящее время этот процессор не поддерживает извлечение файлов, которые были сжаты при "перекатывании".
Теги
tail, file, log, text, source
Свойства
Название | Описание |
---|---|
Tailing mode | Режим просмотра: при просмотре одного файла просматривается только один файл, при просмотре нескольких файлов просматривается список файлов. В режиме просмотра нескольких файлов требуется базовый каталог. |
File(s) to Tail | Path of the file to tail in case of single file mode. If using multifile mode, regular expression to find files to tail in the base directory. In case recursivity is set to true, the regular expression will be used to match the path starting from the base directory (see additional details for examples). Поддерживает язык выражений: true (будет оцениваться только с использованием переменных среды) |
Rolling Filename Pattern | If the file to tail "rolls over" as would be the case with log files, this filename pattern will be used to identify files that have rolled over so that if NiFi is restarted, and the file has rolled over, it will be able to pick up where it left off. This pattern supports wildcard characters * and ?, it also supports the notation ${filename} to specify a pattern based on the name of the file (without extension), and will assume that the files that have rolled over live in the same directory as the file being tailed. The same glob pattern will be used for all files. |
Post-Rollover Tail Period | When a file is rolled over, the processor will continue tailing the rolled over file until it has not been modified for this amount of time. This allows for another process to rollover a file, and then flush out any buffered data. Note that when this value is set, and the tailed file rolls over, the new file will not be tailed until the old file has not been modified for the configured amount of time. Additionally, when using this capability, in order to avoid data duplication, this period must be set longer than the Processor's Run Schedule, and the Processor must not be stopped after the file being tailed has been rolled over and before the data has been fully consumed. Otherwise, the data may be duplicated, as the entire file may be written out as the contents of a single FlowFile. |
Base directory | Базовый каталог, используемый для поиска файлов для просмотра. Это свойство необходимо при использовании режима просмотра нескольких файлов. Поддерживает язык выражений: true (будет оцениваться только с использованием переменных среды) |
Initial Start Position | When the Processor first begins to tail data, this property specifies where the Processor should begin reading data. Once data has been ingested from a file, the Processor will continue from the last point from which it has received data. |
State Location | Specifies where the state is located either local or cluster so that state can be stored appropriately in order to ensure that all data is consumed without duplicating data upon restart of NiFi |
Recursive lookup | При использовании режима «Несколько файлов» это свойство определяет, нужно ли выполнять рекурсивный поиск файлов в базовом каталоге. |
Lookup frequency | Используется только в режиме «Несколько файлов». Указывает минимальную продолжительность ожидания, прежде чем процессор снова выполнит поиск файлов. |
Maximum age | Используется только в режиме «Несколько файлов». Указывает необходимую минимальную продолжительность, в течение которой в файл не будут добавляться новые сообщени я с момента его последней модификации. Не следует устанавливать слишком низкое значение, чтобы избежать дублирования данных в случае, если новые сообщения добавляются с меньшей частотой. |
Reread when NUL encountered | If this option is set to 'true', when a NUL character is read, the processor will yield and try to read the same part again later. (Note: Yielding may delay the processing of other files tailed by this processor, not just the one with the NUL character.) The purpose of this flag is to allow users to handle cases where reading a file may return temporary NUL values. NFS for example may send file contents out of order. In this case the missing parts are temporarily replaced by NUL values. CAUTION! If the file contains legitimate NUL values, setting this flag causes this processor to get stuck indefinitely. For this reason users should refrain from using this feature if they can help it and try to avoid having the target file on a file system where reads are unreliable. |
Line Start Pattern | Регулярное выражение для сопоставления с началом строки журнала. Если указано, любая строка, соответствующая выражению, и все последующие строки будут буферизованы до тех пор, пока другая строка не будет соответствовать выражению. Таким образом, мы можем избежать разделения многострочных сообщений в файле. Это предполагает, что данные представлены в формате UTF-8.This Property is only considered if the [Tailing mode] Property has a value of "Single file". |
Pre-Allocated Buffer Size | Sets the amount of memory that is pre-allocated for each tailed file. |
Max Buffer Size | При использовании шаблона начала строки могут возникнуть ситуации, когда данные в обрабатываемом файле никогда не будут соответствовать регулярному выражению. Это приведёт к тому, что процессор будет буферизировать все данные из обрабатываемого файла, что может быстро привести к исчерпанию памяти. Чтобы избежать этого, процессор буферизует только этот объем данных перед очисткой буфера, даже если это означает использование частичных данных из файла.This Property is only considered if the [Line Start Pattern] Property has a value specified. |