Merge pull request #231 from bobtfish/fix_source_host

Fix @source_host when it comes from json_event
This commit is contained in:
Jordan Sissel 2012-12-27 15:51:24 -08:00
commit 9bf5efdfcc

View file

@ -16,6 +16,7 @@ class LogStash::Event
@cancelled = false
@data = {
"@source_host" => false,
"@source" => "unknown",
"@tags" => [],
"@fields" => {},
@ -96,11 +97,14 @@ class LogStash::Event
val = uri if uri
if val.is_a?(URI)
@data["@source"] = val.to_s
@data["@source_host"] = val.host
maybe_new_source_host = val.host
@data["@source_path"] = val.path
else
@data["@source"] = val
@data["@source_host"] = val
maybe_new_source_host = val
end
if !@data["@source_host"]
@data["@source_host"] = maybe_new_source_host
end
end # def source=