elasticsearch - 从 Logstash 中的多个目录读取文件?

标签 elasticsearch logstash kibana

我使用此配置读取我的日志文件(cron_log、auth_log、mail_log 等):

file{
path => '/path/to/log/file/*_log'
}

所以我阅读了我的日志文件并检查:

if(path) ~= "cron"  -----match--------
if(path) ~= "auth"  -----match--------

现在我有一个目录,如:Server1 Server2 Server3......在Server 1中有子目录:authlog cronlog。 ....在 authlog 中有子目录(如 2014.05.26、2014.05.27),它们最终包含我必须解析的当天的日志文件。

所以目前我有一个配置文件,用于使用 *_log 读取文件,我用来运行该配置文件和 /path/to/log/中存在的所有日志文件文件/*_log 被解析。

现在我必须从许多目录中读取(如上所述)。

我是否必须为每个目录编写单独的配置文件??

使用 logstash 实现此目的的最佳方法是什么?

最佳答案

Ruby globs 将 ** 解释为包括所有子目录。

因此,例如,您可以给出 file input一个路径,例如:

/path/to/date/folders/**/*_log

关于elasticsearch - 从 Logstash 中的多个目录读取文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24017357/

相关文章:

sql - 在 elasticsearch 中从 postgresql 对分区进行排名

python - 如何修复 Elasticsearch 中的错误 "failed to parse date field "

logstash - 一日志中有多种模式

logging - 如何将日志发送到 Graylog (Docker)?

java - 当尝试使用 java 访问 Elastic Search 时,得到空响应

azure - 如何在没有对应用程序网关进行身份验证的情况下从elasticsearch给出200响应?

spring - 带有Spring Boot的ElasticsearchIntegrationTest

ubuntu - 为什么 Elasticsearch 是 8x。以交互方式启动但不是作为服务 Ubuntu 20.04?

elasticsearch - 根据聚合结果构建直方图

elasticsearch - Kibana 显示 The data you are seeing might be incomplete or wrong