logstash无法读取文件,没有设置sincedb_path,根据文件路径生成一个

时间:2015-08-14 03:20:13

标签: logstash

所有。我尝试使用logstash来读取数据。配置是:

input {
  file {
    path =>[ "/usr/share/logstash-1.5.3/test.txt"]
    start_position => beginning
  }
}


output{
  stdout { codec => rubydebug }
}

但它没有工作

调试后,显示如下:

config LogStash::Outputs::Stdout/@workers = 1 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"112", :method=>"config_init"}
Registering file input {:path=>["/usr/share/logstash-1.5.3/test.txt"], :level=>:info, :file=>"logstash/inputs/file.rb", :line=>"76", :method=>"register"}
No sincedb_path set, generating one based on the file path {:sincedb_path=>"/root/.sincedb_8b88439fb77c177f2cae65e1f928b133", :path=>["/usr/share/logstash-1.5.3/test.txt"], :level=>:info, :file=>"logstash/inputs/file.rb", :line=>"119", :method=>"register"}
Pipeline started {:level=>:info, :file=>"logstash/pipeline.rb", :line=>"87", :method=>"run"}
Logstash startup completed
_sincedb_open: /root/.sincedb_8b88439fb77c177f2cae65e1f928b133: No such file or directory - /root/.sincedb_8b88439fb77c177f2cae65e1f928b133 {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"216", :method=>"_sincedb_open"}
_discover_file_glob: /usr/share/logstash-1.5.3/test.txt: glob is: ["/usr/share/logstash-1.5.3/test.txt"] {:level=>:debug, :file=>"filewatch/watch.rb", :line=>"132", :method=>"_discover_file"}
_discover_file: /usr/share/logstash-1.5.3/test.txt: new: /usr/share/logstash-1.5.3/test.txt (exclude is []) {:level=>:debug, :file=>"filewatch/watch.rb", :line=>"141", :method=>"_discover_file"}
caller requested sincedb write () {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"205", :method=>"sincedb_write"}
Plugin is finished {:plugin=><LogStash::Outputs::Stdout codec=><LogStash::Codecs::RubyDebug metadata=>false>, workers=>1>, :level=>:info, :file=>"logstash/plugin.rb", :line=>"61", :method=>"finished"}
Pipeline shutdown complete. {:level=>:info, :file=>"logstash/pipeline.rb", :line=>"101", :method=>"run"}
Logstash shutdown completed

我删除了/ root中的所有自然,仍然无法正常工作

1 个答案:

答案 0 :(得分:1)

也许你可以这样做:

更改输入配置,如下所示:

input {
  file {
    path =>[ "/usr/share/logstash-1.5.3/test.txt"]
    start_position => beginning
    sincedb_path => "/opt/logstash/sincedb-access"
  }
}

然后触摸sincedb_path文件:

touch /opt/logstash/sincedb-access
chown logstash:logstash /opt/logstash/sincedb-access

最重要的是:

ln -s /lib/x86_64-linux-gnu/libcrypt.so.1 /usr/lib/x86_64-linux-gnu/libcrypt.so

您可能丢失了libcrypt.so个文件。