From 006169f7826b603af68865cf137a7030043f50a5 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Tue, 18 Jun 2024 07:24:42 +0800 Subject: [PATCH] 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. --- lib/discourse_logstash_logger.rb | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/discourse_logstash_logger.rb b/lib/discourse_logstash_logger.rb index 0e8b824464f..96f2711fd68 100644 --- a/lib/discourse_logstash_logger.rb +++ b/lib/discourse_logstash_logger.rb @@ -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