Skip to content

Instantly share code, notes, and snippets.

@czj
Last active August 28, 2022 09:06
Show Gist options
  • Save czj/d6e06e9f19156c124128a1eaaa9707be to your computer and use it in GitHub Desktop.
Save czj/d6e06e9f19156c124128a1eaaa9707be to your computer and use it in GitHub Desktop.

Revisions

  1. czj revised this gist Jul 24, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Gemfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    gem "lograge"
    gem "logstash-event"
    gem "logstash-logger"
  2. czj created this gist Jul 24, 2018.
    16 changes: 16 additions & 0 deletions logstash_lograge_rails.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    LogStashLogger.configure do |config|
    config.customize_event do |event|
    event["token"] = "1e23az12e12eza12aze13aez13aez13aez12zae12e123"
    end
    end

    # config/initializers/lograge.rb
    # OR
    # config/environments/production.rb
    Rails.application.configure do
    config.lograge.enabled = true
    config.lograge.formatter = Lograge::Formatters::Logstash.new
    config.lograge.logger = LogStashLogger.new(type: :tcp, host: "listener.logz.io", port: 5050)
    # Optionnal
    # config.lograge.keep_original_rails_log = true
    end