mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
- Hack our hostname into the file url for easy "source" attribution
This commit is contained in:
parent
240ff18dce
commit
6c1ff2abc3
1 changed files with 6 additions and 0 deletions
|
@ -2,11 +2,17 @@ require "logstash/namespace"
|
|||
require "logstash/event"
|
||||
require "eventmachine-tail"
|
||||
require "uri"
|
||||
require "socket" # for Socket.gethostname
|
||||
|
||||
class LogStash::Inputs::File
|
||||
def initialize(url, config={}, &block)
|
||||
@url = url
|
||||
@url = URI.parse(url) if url.is_a? String
|
||||
|
||||
# Hack the hostname into the url.
|
||||
# This works since file:// urls don't generally have a host in it.
|
||||
@url.host = Socket.gethostname
|
||||
|
||||
@config = config
|
||||
@callback = block
|
||||
@tags = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue