mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- Try parsing a url when setting source
This commit is contained in:
parent
0fafebd2c7
commit
b7d24943ea
1 changed files with 3 additions and 0 deletions
|
@ -47,12 +47,15 @@ class LogStash::Event
|
|||
public
|
||||
def source; @data["@source"]; end # def source
|
||||
def source=(val)
|
||||
uri = URI.parse(val) rescue nil
|
||||
val = uri if uri
|
||||
if val.is_a?(URI)
|
||||
@data["@source"] = val.to_s
|
||||
@data["@source_host"] = val.host
|
||||
@data["@source_path"] = val.path
|
||||
else
|
||||
@data["@source"] = val
|
||||
@data["@source_host"] = val
|
||||
end
|
||||
end # def source=
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue