Lnav Log Files Navigator Helps You Analyze Log Files in a Mac OS or Linux Terminal

If you have a problem with your computer, you may have to go through log files, or as a software engineer, you may be looking for clues about a bug in a debug or error log. It can be done in any text editor, but there may be a better way thanks to lnav Log Files Navigator that allows checking those files more easily and efficiently in a Mac OS or Linux terminal.

The following log files are supported by default even if they are compressed with gzip or bzip2:

  • Common Web Access Log format
  • CUPS page_log
  • Syslog
  • Glog
  • VMware ESXi/vCenter Logs
  • dpkg.log
  • uWSGI
  • “Generic” – Any message that starts with a timestamp
  • Strace

lnav is open-source software released under a BSD-2 clause in Github. It’s not new at all as some commits were made in January 2010, but it’s new to me, and hopefully to some of you as well.

There are various ways to install it, but the easiest way in Ubuntu is to install it as a snap.

Launching lnav with no other parameters will open /var/log/syslog automatically.

lnav log files navigatorWarnings are shown in yellow and errors in red. You can easily navigate between errors and warnings with respectively e/E to w/E to move forward/backward through messages.

If you’re familiar with Vi/Vim, using lnav should be fairly easy as many of the commands are the same. For example, we can search with “/” to filter messages with a specific string.

lnav search
Click to Enlarge

You can select the next/previous occurrence of the string with n/N. Tabulation is also supported so you don’t need to copy/paste or type longer strings.

If you want to master the program and make the most of it, you’ll need to read the documentation for command line parameters and shortcuts, as there are so many options.

Some of the cool features of the program include Single Log View showing all logs in a single window based on message timestamps, filtering content with regular expressions, a Timeline View showing when most errors and warnings occurred, Pretty-Print View to reformat structured data such as XML or JSON, and more.

Share this:

Support CNX Software! Donate via cryptocurrencies or become a Patron on Patreon

ROCK Pi 4C Plus
Notify of
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
Weller PCB manufacturer