Skip to content

Purpose: Displays the tail of the server log in the terminal alongside the Rails server output.

License

Notifications You must be signed in to change notification settings

datpmt/rails-tail-log-monitor

Repository files navigation

Rails Tail Log Monitor

The rails-tail-log-monitor gem simplifies the process of monitoring server logs by displaying the tail of the log file directly in the terminal window alongside the standard Rails server output. With rails-tail-log-monitor, developers can effortlessly keep track of the most recent log entries without the need for manual log file inspection.

demo

Installation

Add this line to your application's Gemfile:

gem 'rails-tail-log-monitor', '~> 1.0.0'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install rails-tail-log-monitor

Usage

Make sure your package.json has actioncable

{
  ...,
  "@rails/actioncable": "^6.0.0"
}

Update config/cable.yml

development:
  adapter: redis
  url: <%= "redis://localhost:6379/#{ENV.fetch('REDIS_PORT')}" %>
  channel_prefix: your_app_development

Update routes.rb

# config/routes.rb
Rails.application.routes.draw do
  ...
  # example for usage same Sidekiq
  authenticate :administrator do
    mount Sidekiq::Web => '/sidekiq'
    mount LogMonitor::Engine => '/log'
  end
end

Custom setting config/initializers/rails_tail_log_monitor.rb

LogMonitor.configure do |config|
  config.action_cable_url = "ws://localhost:3000/cable"
  config.keep_alive_time = 60 # default = 30
end

After installation and configuration, start your Rails application, open http://localhost:3000/log URL, and make a few requests.

Contributors

I welcome contributions to this project.

  1. Fork it.
  2. Create your feature branch (git checkout -b your-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin your-feature).
  5. Create a new pull request.

License

The gem is available as open source under the terms of the MIT License.

About

Purpose: Displays the tail of the server log in the terminal alongside the Rails server output.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published