Introduction

The Log File Navigator, lnav, is an advanced log file viewer for the terminal. It provides an easy-to-use interface for monitoring and analyzing your log files with little to no setup. Simply point lnav at your log files and it will automatically detect the Log Formats, index their contents, and display a combined view of all log messages. You can navigate through your logs using a variety of hotkeys. Commands give you additional control over lnav’s behavior for doing things like applying filters, tagging messages, and more. You can then analyze your log messages using the SQLite Interface.

Screenshot of lnav showing a mix of syslog and web access_log messages.

Screenshot of lnav viewing syslog and web access_log messages.

Downloads

Binaries and source code for lnav can be downloaded from the releases page.

When building from source, follow the steps in Development.

Viewing Logs

The arguments to lnav are the log files, directories, or URLs to be viewed. For example, to view all of the CUPS logs on your system:

lnav /var/log/cups

The formats of the logs are determined automatically and indexed on-the-fly. See Log Formats for a listing of the predefined formats and how to define your own.

If no arguments are given, lnav will try to open the syslog file on your system:

lnav

Setup

After starting lnav, you might want to set the configuration options mentioned below. Configuration in lnav is done using the :config command. To change a configuration option, start by pressing : to enter the command prompt. Then, type “config” followed by the option name and value.

Note

Tab-completion is available for these configuration options and, in some cases, their values as well.

Keymap

The keymap defines the mapping from hotkeys to commands to execute. The default mapping is for “U.S.” keyboards. The following command can be used to change the keymap:

:config /ui/keymap <keymap-name>

The builtin keymaps are:

To create or customize a keymap, consult the Keymap Definitions section.

Theme

The visual styling of lnav can be customized using a theme. The following command can be used to the change the theme:

:config /ui/theme <theme-name>

The builtin themes are: default, dracula, eldar, grayscale, monocai, night-owl, solarized-dark, and solarized-light.

To create or customize a theme, consult the Theme Definitions section.

Cursor Mode (v0.11.2+)

The default mode for scrolling in lnav is “cursor” mode where there is a cursor line in the view that is moved by the arrow keys and other interactions. Any interactions, such as jumping to a search hit, are then focused on that line.

Alternatively, you can enable “top” mode where the contents of the main view are moved when the arrow keys are pressed. Any interactions, such as jumping to a search hit, are then focused on the top line in the view. You can change to “top” mode with the following command:

:config /ui/movement/mode top

Mouse Support (v0.12.2+)

Mouse support can be enabled temporarily by pressing F2 and can be set as the default by executing the following command:

:config /ui/mouse/mode enabled

See Mouse Support (v0.12.2+) for more details.

Log Formats

In order for lnav to understand your log files, it needs to told how to parse the log messages using a log format definition. There are many log formats builtin and lnav will automatically determine the best format to use. In case your log file is not recognized, consult the Log Formats section for information on how to create a format.

Development

Development of lnav is hosted on GitHub.

Issues should be used for bugs and feature requests.

Discussions should be used for asking questions and sharing tips.

Dependencies

When compiling from source, the following dependencies are required:

Installation

Check the downloads page to see if there are packages for your operating system. To compile from source, use the following commands:

Note

Run ./autogen.sh if compiling from the git repository.

./configure
make
sudo make install