简体   繁体   中英

Reading a file from a URI in logstash

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

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

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.

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM