From 8b5cc6b35e0ce3244ebb75f9bf2c04132c07cc10 Mon Sep 17 00:00:00 2001 From: kjgarza Date: Thu, 30 Jan 2020 17:14:41 +0100 Subject: [PATCH] move lograge --- config/application.rb | 25 +++++++++++++++++++++++++ config/initializers/_lograge.rb | 26 -------------------------- 2 files changed, 25 insertions(+), 26 deletions(-) delete mode 100644 config/initializers/_lograge.rb diff --git a/config/application.rb b/config/application.rb index 9df4f3da7..abf55cad0 100644 --- a/config/application.rb +++ b/config/application.rb @@ -81,6 +81,31 @@ class Application < Rails::Application # secret_key_base is not used by Rails API, as there are no sessions config.secret_key_base = "blipblapblup" + config.lograge.enabled = true + config.lograge.formatter = Lograge::Formatters::Logstash.new + config.lograge.logger = ::LogStashLogger.new( + type: :stdout + ) + config.lograge.log_level = ENV["LOG_LEVEL"].to_sym + + config.active_job.logger = config.lograge.logger + + config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"] + config.lograge.ignore_custom = lambda do |event| + event.payload.inspect.length > 100000 + end + config.lograge.base_controller_class = "ActionController::API" + + config.lograge.custom_options = lambda do |event| + exceptions = %w(controller action format id) + { + params: event.payload[:params].except(*exceptions), + uid: event.payload[:uid], + } + end + config.logger = config.lograge.logger + config.active_record.logger = nil + # configure caching config.cache_store = :dalli_store, nil, { :namespace => ENV['APPLICATION'] } diff --git a/config/initializers/_lograge.rb b/config/initializers/_lograge.rb deleted file mode 100644 index eb6693412..000000000 --- a/config/initializers/_lograge.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -require "elasticsearch/rails/lograge" - -Rails.application.configure do - config.lograge.enabled = true - config.lograge.formatter = Lograge::Formatters::Logstash.new - config.lograge.logger = LogStashLogger.new(type: :stdout) - config.lograge.log_level = ENV["LOG_LEVEL"].to_sym - - config.active_job.logger = config.lograge.logger - - config.lograge.ignore_actions = ["HeartbeatController#index", "IndexController#index"] - config.lograge.ignore_custom = lambda do |event| - event.payload.inspect.length > 100000 - end - config.lograge.base_controller_class = "ActionController::API" - - config.lograge.custom_options = lambda do |event| - exceptions = %w(controller action format id) - { - params: event.payload[:params].except(*exceptions), - uid: event.payload[:uid], - } - end -end