Shorter logs in Heroku/Rails 5

Mark Miller

Each line in my Heroku logs contains a verbose amount of information at the beginning:

2018-12-06T17:50:11.193851+00:00 app[web.1]: I, [2018-12-06T17:50:11.193690 #4]  INFO -- : [0f0791d6-3aab-4f19-83ad-c421af4a0788] Started GET "/users/edit" for xx.xxx.xxx.xxx at 2018-12-06 17:50:11 +0000

This makes it hard to read the logs on a small screen.

How can I shorten this to only the message itself?

Started GET "/users/edit" for xx.xxx.xxx.xxx at 2018-12-06 17:50:11 +0000
Jay Dorsey

If you're not constrained by viewing via the command line there are a number of heroku add-on tools for aggregating and viewing logs that will provide a nicer interface for viewing the logs. Most of them have a free tier and include features such as filtering, hiding columns, etc. You can find them under logging here: https://elements.heroku.com/addons

If you are limited to cli tools, you might look at lnav. At a minimum it looks like it allows you to shift the entire log over to one side or the other, along with filtering and other tools.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related