SQLite Tables Reference#

In addition to the tables generated for each log format, lnav includes the following tables/views:

These extra tables provide useful information and can let you manipulate lnav’s internal state. You can get a dump of the entire database schema by executing the ‘.schema’ SQL command, like so:



The environ table gives you access to the lnav process’ environment variables. You can SELECT, INSERT, and UPDATE environment variables, like so:

;SELECT * FROM environ WHERE name = 'SHELL'
 name   value
SHELL /bin/tcsh

;UPDATE environ SET value = '/bin/sh' WHERE name = 'SHELL'

Environment variables can be used to store simple values or pass values from lnav’s SQL environment to lnav’s commands. For example, the :open command will do variable substitution, so you can insert a variable named “FILENAME” and then open it in lnav by referencing it with “$FILENAME”:

;INSERT INTO environ VALUES ('FILENAME', '/path/to/file')


The fstat table-valued function provides access to the local file system. The function takes a file path or a glob pattern and returns the results of lstat(2) for the matching files. If the parameter is a pattern that matches nothing, no rows will be returned. If the parameter is a path for a non-existent file, a row will be returned with the error column set and the stat columns as NULL. To read the contents of a file, you can SELECT the hidden data column.


The all_logs table lets you query the format derived from the lnav log message parser that is used to automatically extract data, see Extracting Data for more details.


The http_status_codes table is a handy reference that can be used to turn HTTP status codes into human-readable messages.

regexp_capture(<string>, <regex>)#

The regexp_capture() table-valued function applies the regular expression to the given string and returns detailed results for the captured portions of the string.