For reference, there is a very easy way to do this. However, you will want to protect this page with some kind of authentication / authorization.
Controller:
lines = params[:lines] if Rails.env == "production" @logs = `tail -n #{lines} log/production.log` else @logs = `tail -n #{lines} log/development.log` end
View log file:
<pre><%= @logs %></pre>
View image link:
<%= link_to "log file", log_path(lines: 100) %>
Routes
get 'logs/:lines' => "pages#log", as: "log"
source share