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:
Alan Guo Xiang Tan 2024-06-18 07:24:42 +08:00 committed by GitHub
parent 0a881a59d3
commit 006169f782
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 11 deletions

View File

@ -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