从logstash中的URI读取文件

时间:2016-11-11 16:00:09

标签: logstash

我有一个文件坐在远程服务器上。我通过URI知道该文件:

http://some.server/dir/derp/syslog.log

当我使用logstash 文件输入时,URI被拒绝,并出现抱怨相对路径的错误。远程文件没有安全性。我可以curl在没有问题的情况下使用logstash系统。

我的newb-config输入代码段如下:

input {
        file {
        path => "http://some.server/dir/derp/syslog.log"
        type => "syslog"
        }

阅读文件的正确方法是什么?

1 个答案:

答案 0 :(得分:1)

The file input plugin doesn't read remote files, it only allows to read files from the local host.

You have a few solutions:

A. You can install filebeat on your remote server some.server to tail that syslog file and either ship it to your logstash or directly to your ES server.

B. You can install Logstash directly on your remote server and have the file input plugin tail that file directly on the server.

C. You can use the http_poller input plugin in order to retrieve that file via HTTP.

input {
  http_poller {
    urls => {
      mysyslog => "http://some.server/dir/derp/syslog.log"
    }
    request_timeout => 60
    interval => 60
  }
}