2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

EXPERIMENTAL: Allow logs to be shipped via different methods.

See https://github.com/dwbutler/logstash-logger#uri-configuration for
a list of available methods.
This commit is contained in:
Guo Xiang Tan 2017-11-14 12:50:26 +08:00
parent 0d8e9a88c9
commit 89d9ffa884
7 changed files with 30 additions and 63 deletions

View file

@ -0,0 +1,16 @@
require 'logstash-logger'
class DiscourseLogstashLogger
def self.logger(uri:, type:)
LogStashLogger.new(
uri: uri,
sync: true,
customize_event: ->(event) {
event['hostname'] = `hostname`.chomp
event['severity'] = Object.const_get("Logger::Severity::#{event['severity']}")
event['severity_name'] = event['severity']
event['type'] = type
},
)
end
end