Skip to content

Commit

Permalink
Merge branch 'master' into feature_new_logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Jan 30, 2020
2 parents 9124725 + d3d5c2b commit b815388
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
26 changes: 0 additions & 26 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
require "action_controller/railtie"
require "rails/test_unit/railtie"
require "active_job/logging"
require "elasticsearch/rails/lograge"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Expand Down Expand Up @@ -82,31 +81,6 @@ 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'] }

Expand Down
26 changes: 26 additions & 0 deletions config/initializers/_lograge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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

0 comments on commit b815388

Please sign in to comment.