【问题标题】:Logstash not reading file inputLogstash 不读取文件输入
【发布时间】:2014-07-20 16:44:53
【问题描述】:

我对 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 服务器并验证是否正在接收数据 卷曲查询。问题是,当输入为file 时,没有接收到任何数据。但是,如果我将输入更改为stdin { },如下所示,它会顺利发送所有输入数据:

input {
  stdin{ }
}
output {
  elasticsearch {
    protocol => "http"
    host => "10.35.143.93"
    port => "9200"
    index => "latestindex"
  }
}

我不知道哪里出错了。有人可以看看这个吗?

【问题讨论】:

  • Log stash 将发送数据。仅当您更改文件时。您更改数据我是那个日志文件?

标签: file logging input elasticsearch logstash


【解决方案1】:

除了提供的答案之外,我还必须将路径从 c:\my\path 更改为 c:/my/path 才能读取文件。

【讨论】:

  • 这行得通,为我节省了很多时间。谢谢。
【解决方案2】:

您应该在文件部分下设置 start_position:

start_position => "beginning"

它默认为 end,因此不会读取文件中的任何现有行,只会读取新添加的行:

开始位置

Value can be any of: "beginning", "end"
Default value is "end"

选择 Logstash 开始读取文件的初始位置:在开头 或最后。默认行为将文件视为实时流和 因此从最后开始。如果您有要导入的旧数据,请设置 这是“开始”

此选项仅修改文件被访问的“第一次联系”情况 新的和以前没见过的。如果之前已经看过一个文件,则此 选项无效。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-14
  • 1970-01-01
相关资源
最近更新 更多