我们有一个系统将日志文件上传到一个以日期命名的文件夹中。它看起来像:
/logs
/20181030
/20181031
/20181101
/20181102
/...
假设我想跟踪11月份使用spooldir生成的日志文件,我该怎么做?
# this won't work
a1.sources.r1.spoolDir = /logs/201811??
# this seems only works with files. Is it possible to filter folders here?
a1.sources.r1.includePattern = ^.*\.txt$
1条答案
按热度按时间np8igboo1#
根据flume源代码,在递归文件夹树(注册文件夹跟踪器)时,将跳过与ignorepattern匹配的文件夹。因此,您可以忽略与您的条件不匹配的文件夹。
^(?!201811..).*$
将排除不是2018年11月的文件夹的所有文件夹。不会跟踪其他文件夹。但这种模式也适用于文件名。所以任何文件名不匹配^201811..$
也将被忽略。您可以添加^.*\.txt$
将模式(用于include模式的模式)添加到regex,以使flume接受您的输入文件。会帮你的。