Don't add time to logs when using logstash formatter.
This commit is contained in:
parent
edf4af608e
commit
09cee4c315
|
@ -4,6 +4,8 @@ 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_formatter = ENV["LOGSTASH_FORMATTER"]
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
@ -13,11 +15,13 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV["
|
||||||
output = {
|
output = {
|
||||||
params: params,
|
params: params,
|
||||||
database: RailsMultisite::ConnectionManagement.current_db,
|
database: RailsMultisite::ConnectionManagement.current_db,
|
||||||
time: event.time,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output[:time] = event.time unless logstash_formatter
|
||||||
|
output
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV["LOGSTASH_FORMATTER"]
|
if logstash_formatter
|
||||||
config.lograge.formatter = Lograge::Formatters::Logstash.new
|
config.lograge.formatter = Lograge::Formatters::Logstash.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue