Add type when shipping logs to logstash.
This commit is contained in:
parent
d487be759c
commit
afdd31473d
|
@ -4,16 +4,21 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV["
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
config.lograge.enabled = true
|
config.lograge.enabled = true
|
||||||
|
|
||||||
|
logstash_uri = ENV["LOGSTASH_URI"].present?
|
||||||
|
|
||||||
config.lograge.custom_options = lambda do |event|
|
config.lograge.custom_options = lambda do |event|
|
||||||
exceptions = %w(controller action format id)
|
exceptions = %w(controller action format id)
|
||||||
|
|
||||||
{
|
output = {
|
||||||
params: event.payload[:params].except(*exceptions),
|
params: event.payload[:params].except(*exceptions),
|
||||||
type: :rails
|
database: RailsMultisite::ConnectionManagement.current_db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output[:type] = :rails if logstash_uri
|
||||||
|
output
|
||||||
end
|
end
|
||||||
|
|
||||||
if (logstash_uri = ENV["LOGSTASH_URI"].present?)
|
if logstash_uri
|
||||||
require 'logstash-logger'
|
require 'logstash-logger'
|
||||||
|
|
||||||
config.lograge.formatter = Lograge::Formatters::Logstash.new
|
config.lograge.formatter = Lograge::Formatters::Logstash.new
|
||||||
|
|
Loading…
Reference in New Issue