DEV: Remove `hostname` from `DiscourseLogstashLogger` output (#27485)
This is a duplicate of the `host` field which means we are bloating the logs unnecessarily. Just remove without depreciation for now but we are open to properly depreciating it if others depend on this field.
This commit is contained in:
parent
0a881a59d3
commit
006169f782
|
@ -3,22 +3,11 @@
|
|||
require "logstash-logger"
|
||||
|
||||
class DiscourseLogstashLogger
|
||||
def self.hostname
|
||||
@hostname ||=
|
||||
begin
|
||||
require "socket"
|
||||
Socket.gethostname
|
||||
rescue => e
|
||||
`hostname`.chomp
|
||||
end
|
||||
end
|
||||
|
||||
def self.logger(uri:, type:)
|
||||
LogStashLogger.new(
|
||||
uri: uri,
|
||||
sync: true,
|
||||
customize_event: ->(event) do
|
||||
event["hostname"] = self.hostname
|
||||
event["severity_name"] = event["severity"]
|
||||
event["severity"] = Object.const_get("Logger::Severity::#{event["severity"]}")
|
||||
event["type"] = type
|
||||
|
|
Loading…
Reference in New Issue