logstasher icon indicating copy to clipboard operation
logstasher copied to clipboard

0.8 broken? Got spam in log

Open ex0rcist opened this issue 9 years ago • 2 comments

Hello! Last evening I've updated logstaher from 0.6.5 to 0.8 (even not thinking about it, just bundle update), and this morning I accidentally came to my Kibana instance that gathering logs from production, and ... WOW, 10 mil log entries! After update, logstaher has started to write some **** to logs like "null" and templates render messages. That was amazing experience. Please investigate :)

Here is my production.rb

  config.logstasher.enabled = true
  config.logstasher.suppress_app_log = false
  config.logstasher.source = 'randewoo_production'
  config.logstasher.logger_path = 'log/logstasher_production.log'
  config.logstasher.backtrace = false

and initializer:

if LogStasher.enabled
  LogStasher.add_custom_fields do |fields|
    fields[:request_path] = request.path
    fields[:site] = request.path =~ /^\/api/ ? 'api' : 'frontend'

    controller = "#{params[:controller]}_params".gsub(/\//, '_')
    fields[controller.to_sym] = params.reject { |k| ['controller', 'action'].include? k }
  end
end

ex0rcist avatar Oct 27 '15 09:10 ex0rcist

I've also seen these new template render messages when upgrading from 0.7.0 to 0.8.6

davidbasalla avatar Nov 19 '15 13:11 davidbasalla

I did this in my config/logstasher.rb

::ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
    case subscriber.class.name
      when 'LogStasher::ActionView::LogSubscriber'
        LogStasher.unsubscribe(:action_view, subscriber)
      when 'LogStasher::ActiveRecord::LogSubscriber'
        LogStasher.unsubscribe(:active_record, subscriber)
    end
  end

Also a good idea due to #93

ctaintor avatar Dec 05 '15 18:12 ctaintor