mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:44:49 +08:00
EXPERIMENTAL: Allow Logstash formatter to be enable for lograge logs.
This commit is contained in:
parent
076df104dc
commit
d888d3c54c
1
Gemfile
1
Gemfile
|
@ -173,6 +173,7 @@ gem 'memory_profiler', require: false, platform: :mri
|
|||
gem 'cppjieba_rb', require: false
|
||||
|
||||
gem 'lograge', require: false
|
||||
gem 'logstash-event', require: false
|
||||
gem 'logster'
|
||||
|
||||
gem 'sassc', require: false
|
||||
|
|
|
@ -155,6 +155,7 @@ GEM
|
|||
activesupport (>= 4, < 5.2)
|
||||
railties (>= 4, < 5.2)
|
||||
request_store (~> 1.0)
|
||||
logstash-event (1.2.02)
|
||||
logster (1.2.8)
|
||||
loofah (2.1.1)
|
||||
crass (~> 1.0.2)
|
||||
|
@ -438,6 +439,7 @@ DEPENDENCIES
|
|||
http_accept_language (~> 2.0.5)
|
||||
listen
|
||||
lograge
|
||||
logstash-event
|
||||
logster
|
||||
lru_redux
|
||||
mail
|
||||
|
|
|
@ -7,11 +7,18 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV["
|
|||
config.lograge.custom_options = lambda do |event|
|
||||
exceptions = %w(controller action format id)
|
||||
|
||||
params = event.payload[:params].except(*exceptions)
|
||||
params[:files].map!(&:headers) if params[:files]
|
||||
|
||||
output = {
|
||||
params: event.payload[:params].except(*exceptions),
|
||||
params: params,
|
||||
database: RailsMultisite::ConnectionManagement.current_db,
|
||||
time: event.time,
|
||||
}
|
||||
end
|
||||
|
||||
if ENV["LOGSTASH_FORMATTER"]
|
||||
config.lograge.formatter = Lograge::Formatters::Logstash.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user