Back to Lnav

Index

docs/tutorials/tutorial1/index.md

0.14.03.1 KB
Original Source

Tutorial 1

Welcome to the first interactive lnav tutorial!

This tutorial will guide you through the basics of navigating log files. Pressing q will display an example log file to try out commands on. Pressing y will return you to the next step in the tutorial.

Step 1

Finding errors quickly is one of the main use-cases for lnav. To make that quick and easy, lnav parses the log messages in log files as they are loaded and builds indexes of the errors and warnings. You can then use the following hotkeys to jump to them in the log view:

KeyAction
eMove to the next <span class="-lnav_log-level-styles_error">error</span>
Shift+EMove to the previous <span class="-lnav_log-level-styles_error">error</span>
wMove to the next <span class="-lnav_log-level-styles_warning">warning</span>
Shift+WMove to the previous <span class="-lnav_log-level-styles_warning">warning</span>

To complete this step in the tutorial, you'll need to navigate to the errors and warnings in the sample log file. You can check the upper-right ↗↗↗ status bar for tips on what you need to do next. Now, press q to switch to the log view and begin navigating the sample log file.

Step 2

To search for text in files, you can press / to enter the search prompt. To make it easier to search for text that is on-screen, you can press TAB to complete values that are shown on screen. For example, to search for the UUID "1AF9293A-F42D-4318-BCDF-60234B240955" that is in one of the error messages, you can enter "1AF9" and then press TAB to complete the rest of the UUID.

Press q to switch to the log view and try searching for the UUID.

Step 3

To move to a particular time in the logs, you have a few options:

  • The number keys can be used to move to messages at the ten-minute marks within an hour. For example, pressing 2 will move to the first message after the next twenty-minute mark, pressing 3 will move to the next half-hour mark, and so on.
  • Pressing ` to focus on the breadcrumb bar, then you can press TAB (or right-arrow) to move to the time crumb. With the time crumb selected, you can then type in an absolute or relative time. Or, you can use the up and down arrow keys to select a preset relative time.
  • Pressing : will activate the command prompt, then you can use the :goto command to move to a given timestamp (or line number).

Press q to switch to the log view and try moving to different times.

Conclusion

That's all for now, thanks for your time! Visit the downloads page to find out how to download or install lnav for your system. The full documentation is available at https://docs.lnav.org

Press q to switch to the log view and then press q again to exit lnav.

Colophon

The source for this tutorial is available here:

https://github.com/tstack/lnav/tree/master/docs/tutorials/