You know the following commands : more
, grep
, tail -f
, vi
: here is the command that does all that : lnav
You can install lnav
just by installing the corresponding package :
1 |
sudo apt-get install lnav |
You get a listing which is dynamically refresh like tail -f
does. You can search like vi
by using /
command, you can also filter with the command :filter-in regex
(acts like a grep
) or with :filter-out regex
(acts like a grep -v
) :
Just press Ctrl-R
to go back without filter
You can even have an histogram display the number of errors that occured every hour, just press i
:
There are much more :
Single Log View : All log file contents are merged into a single view based on message timestamps.
Automatic Log Format Detection : lnav recognizes webserver logs, syslog, Glog, VMWare logs, uwsgi logs etc… and any logs starting with a timestamp
Filters : Display only lines that match or do not match a set of regular expressions.
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.
Pretty-Print View : The pretty-print view will reformat structured data, like XML or JSON, so that it is easier to read.
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.
Syntax Highlighting : Errors and warnings are colored in red and yellow, respectively. Highlights are also applied to: SQL keywords, XML tags, file and line numbers in Java backtraces, and quoted strings.
Tab-completion : The command prompt supports tab-completion for almost all operations. For example, when doing a search, you can tab-complete words that are displayed on screen
Let’s have a try, and go to official site : http://lnav.org/