从Logstash中的URI读取文件 [英] Reading a file from a URI in logstash

查看:292
本文介绍了从Logstash中的URI读取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a file sitting on a remote server. I know the file by its URI:

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

当我使用logstash file 输入时,该URI被拒绝,并显示一条错误消息,提示相对路径.远程文件上没有安全性.我可以从logstash系统中curl没有问题.

When I use the logstash file input, the URI is rejected with an error complaining of a relative path. There is no security on the remote file. I can curl it without issue from the logstash system.

我的newb-config输入片段如下:

My newb-config input snippet looks like:

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

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

What's the right way to read the file?

推荐答案

file输入插件不读取远程文件,仅允许从本地主机读取文件.

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

您有一些解决方案:

A.您可以在远程服务器 >尾随该syslog文件,然后将其发送到logstash或直接发送到ES服务器.

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.您可以直接在远程服务器上安装Logstash,并让file输入插件将该文件尾部直接在服务器上.

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

C.您可以使用 http_poller输入插件以便通过HTTP检索该文件.

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
  }
}

这篇关于从Logstash中的URI读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆