LNAV – Advanced Terminal Log File Viewer

LNAV – The Logfile Navigator, is an enhanced log file viewer that takes advantage of any semantic information that can be gleaned from the files being viewed, such as timestamps and log levels.

Using this extra semantic information, lnav can do things like interleaving messages from different files, generate histograms of messages over time, and providing hotkeys for navigating through the file. It is hoped that these features will allow the user to quickly and efficiently zero in on problems.

LNAV - The Logfile Navigator
LNAV – The Logfile Navigator

This tool comes with the following features:

  • Single Log View – All log file contents are merged into a single view based on message timestamps. You no longer need to manually correlate timestamps across multiple windows or figure out the order in which to view rotated log files. The color bars on the left-hand side help to show which file a message belongs to.
  • Automatic Log Format Detection – The log message format is automatically determined by lnav while scanning your files.   
  • Filters – Display only lines that match or do not match a set of regular expressions. Useful for removing extraneous log lines that you are not interested in.
  • Timeline View – The timeline view shows a histogram of messages over time. The number of warnings and errors are highlighted in the display so that you can easily see where problems have occurred. Once you have found a period of time that is of interest, a key-press will take you back to the log message view at the corresponding time.
  • Pretty-Print View – The pretty-print view will reformat structured data, like XML or JSON, so that it is easier to read. Simply press SHIFT+P in the log view to have all the currently displayed lines pretty-printed.
  • Query Logs Using SQL – Log files are directly used as the backing for SQLite virtual tables. This means you can perform queries on messages without having to load the data into an SQL database.
  • Automatic Data Extraction
  • “Live” Operation – Searches are done as you type; new log lines are automatically loaded and searched as they are added; filters apply to lines as they are loaded; and, SQL queries are checked for correctness as you type.

You can read more and download this tool over here: https://github.com/tstack/lnav

Share