mirror of
https://github.com/elastic/logstash.git
synced 2025-04-25 07:07:54 -04:00
Fix @source_host when it comes from json_event
This is due to the change 1fc568e07d
which tries to get the @source value set sanely for json_event events which don't
have one.
However Logstash::Event unilaterally resets the @source_host when @source is set, which
is not what we want, at all. I have changed this so that @source_host is only set from
source in the case where @source_host was previously unset
This commit is contained in:
parent
1fc568e07d
commit
fe1657a23c
1 changed files with 7 additions and 3 deletions
|
@ -15,6 +15,7 @@ class LogStash::Event
|
||||||
@cancelled = false
|
@cancelled = false
|
||||||
|
|
||||||
@data = {
|
@data = {
|
||||||
|
"@source_host" => false,
|
||||||
"@source" => "unknown",
|
"@source" => "unknown",
|
||||||
"@tags" => [],
|
"@tags" => [],
|
||||||
"@fields" => {},
|
"@fields" => {},
|
||||||
|
@ -83,11 +84,14 @@ class LogStash::Event
|
||||||
val = uri if uri
|
val = uri if uri
|
||||||
if val.is_a?(URI)
|
if val.is_a?(URI)
|
||||||
@data["@source"] = val.to_s
|
@data["@source"] = val.to_s
|
||||||
@data["@source_host"] = val.host
|
maybe_new_source_host = val.host
|
||||||
@data["@source_path"] = val.path
|
@data["@source_path"] = val.path
|
||||||
else
|
else
|
||||||
@data["@source"] = val
|
@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
|
||||||
end # def source=
|
end # def source=
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue