Viewing Unix Log Files Viewing Unix Log Files unix unix

Viewing Unix Log Files


A common problem is that logs have too many processes writing to them, I prefer to filter my log files and control the output using:

tail -f /var/log/<some logfile> | grep <some identifier> | more

This combination of commands allows you to watch an active log file without getting overwhelmed by the output.


I opt for less. A reason for this is that (with aid of lessopen) it can read gzipped log (as archived by logrotate).

As an example with this single command I can read in time ordered mode dpkg log, without treating differently gzipped ones:

less $(ls -rt /var/log/dpkg.log*) | less


Multitail is the best option, because you can view multiple logs at the same time. It also colors stuff, and you can set up regex to highlight entries you're looking for.