简体   繁体   English

logstash不会将旧日志导入ES

[英]Old logs are not imported into ES by logstash

When I start logstash, the old logs are not imported into ES. 当我启动logstash时,旧日志不会导入ES。
Only the new request logs are recorded in ES. 只有新的请求日志记录在ES中。
Now I've see this in the doc . 现在我在文档中看到了这一点。

Even if I set the start_position=>"beginning" , old logs are not inserted. 即使我设置start_position=>"beginning" ,也不会插入旧日志。
This only happens when I run logstash on linux. 这只发生在我在linux上运行logstash时。

If I run it with the same config, old logs are imported. 如果我使用相同的配置运行它,则会导入旧日志。
I don't even need to set start_position=>"beginning" on windows. 我甚至不需要在windows上设置start_position=>"beginning"

Any idea about this ? 对此有何想法?

When you read an input log to Logstash, Logstash will keep an record about the position it read on this file, that's call sincedb . 当您将输入日志读取到Logstash时,Logstash将记录它在此文件上读取的位置,即调用sincedb

Where to write the sincedb database (keeps track of the current position of monitored log files). 
The default will write sincedb files to some path matching "$HOME/.sincedb*"

So, if you want to import old log files, you must delete all the .sincedb* at your $HOME. 因此,如果要导入旧日志文件,则必须删除$ HOME处的所有.sincedb *。 Then, you need to set 然后,你需要设置

start_position=>"beginning" START_POSITION => “开头”

at your configuration file. 在您的配置文件中。

Hope this can help you. 希望这可以帮到你。

Please see this line also. 请看这一行。

This option only modifies "first contact" situations where a file is new and not seen before. 此选项仅修改文件是新的且之前未见过的“第一次联系”情况。 If a file has already been seen before, this option has no effect. 如果之前已经看过某个文件,则此选项无效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM