我在使用 Logstash 时遇到了一个奇怪的问题。我提供一个日志文件作为logstash 的输入。配置如下:
input {
file {
type => "apache-access"
path => ["C:\Users\spanguluri\Downloads\logstash\bin\test.log"]
}
}
output {
elasticsearch {
protocol => "http"
host => "10.35.143.93"
port => "9200"
index => "latestindex"
}
}
我已经在运行 elasticsearch 服务器并验证是否正在接收数据
卷曲查询。问题是,当输入是a时没有接收到数据file
。但是,如果我将输入更改为stdin { }
如下,顺利发送所有输入数据:
input {
stdin{ }
}
output {
elasticsearch {
protocol => "http"
host => "10.35.143.93"
port => "9200"
index => "latestindex"
}
}
我不明白我哪里错了。有人可以看一下这个吗?
您应该在文件部分下设置 start_position :
start_position => "beginning"
它默认为结束,因此不会读取文件中的任何现有行,只会读取新添加的行:
起始位置
Value can be any of: "beginning", "end"
Default value is "end"
选择 Logstash 最初开始读取文件的位置:开头
或在最后。默认行为将文件视为实时流和
因此从最后开始。如果您有要导入的旧数据,请设置
这到‘开始’
此选项仅修改文件所在的“首次接触”情况
新的并且以前没有见过。如果之前已经看过某个文件,则此
选项没有效果。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)