如何在logstash流程实例读取文档后自动停止

如何在logstash流程实例读取文档后自动停止,logstash,Logstash,我想问一下,下面是我的代码。使用下面的代码,logstash读取文件,直到文件结束。然后,它停止读取,但进程仍处于活动状态。我希望这个过程在完成阅读后停止。我该怎么做 file { path => "directory/*.log" start_position => "beginning" mode => "read" } 感谢您回答请尝试使用标准输入插件而不是文

我想问一下,下面是我的代码。使用下面的代码,logstash读取文件,直到文件结束。然后,它停止读取,但进程仍处于活动状态。我希望这个过程在完成阅读后停止。我该怎么做

file {
        path => "directory/*.log"
        start_position => "beginning"
        mode => "read"
 
}

感谢您回答

请尝试使用标准输入插件而不是文件输入,并将文件作为输入传递到启动日志存储的命令中。 e、 g

bin/logstash-f readFileFromStdin.conf
对于多个文件,您可以执行以下操作

bin/logstash -f readFileFromStdin.conf < cat /path_to_file/*.log
bin/logstash-f readFileFromStdin.conf

cat/path\u to\u file/*.log>/tmp/myLogs
bin/logstash-f readFileFromStdin.conf
用于一个有效的文件。但是我想要目录中的所有日志文件。“directory/*.log”。为此,我不能随意地说出他们的名字?你能举个例子吗?如果有的话。我会接受答案。谢谢你编辑了多个文件的答案。希望有帮助。非常感谢
bin/logstash -f readFileFromStdin.conf < cat /path_to_file/*.log
cat /path_to_file/*.log > /tmp/myLogs
bin/logstash -f readFileFromStdin.conf < /tmp/myLogs