0.0
The project is in a healthy, maintained state
Access log files on remote server
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Logs Explorer

Access to the logs files and shell commands from the browser.

Usage

Add this gem to the Gemfile and open /logs-explorer path.

Additionaly you need to configure files which you want to get access to config/initializers/logs_explorer.rb:

LogsExplorer.setup do |config|
  config.enabled = true
  config.fetch_timeout = 1000
  config.console = true
  config.logs = [
    {
      name: "staging.log",
      path: "log/staging.log"
    },
    {
      name: "sidekiq.log",
      path: "log/sidekiq.log"
    },
    {
      name: "cron.log",
      path: "log/cron.log"
    }
  ]
  # or list all log files in the log directory
  # Dir.glob("log/*.log").sort.map { |entry| { name: File.basename(entry), path: entry } }
  config.commands = [
    {
      name: "ps aux",
      command: "ps aux"
    },
    {
      name: "free -m",
      command: "free -m"
    }
  ]
  
  # protect your Performance Dashboard with HTTP BASIC password
  # config.http_basic_authentication_enabled   = false
  # config.http_basic_authentication_user_name = 'logs_explorer'
  # config.http_basic_authentication_password  = 'logs_explorer'

  # if you need an additional rules to check user permissions
  # config.verify_access_proc = proc { |controller| true }
  # for example when you have `current_user`
  # config.verify_access_proc = proc { |controller| controller.current_user && controller.current_user.admin? }

end if defined?(LogsExplorer)

To execute rake task from the browser console, use the following syntax:

Rake::Task['task_name'].execute # or
Rake::Task['task_name'].invoke

You can use configuration options above to protect access to the logs for a specific user or by HTTP BASIC auth.

Please note, that this is not a real Rails console as we used, it's basically evaluating Ruby code sent to the server (stateless).

Installation

Add this gem to the needed group of gems. For example for staging env. Be careful with production env and access to the logs.

group :staging do
  gem 'logs_explorer'
end

And then execute:

$ bundle

After the installation start the server and open the /logs-explorer. Make sure that before you created an initializer and condifured all needed commands and files.

You need to have a "tail" and "wc" utils commands on the server to make everything working.

TODO

  • specs

Contributing

You are welcome to contribute.

License

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