View log files in Ubuntu Linux

by Vivek Gite · 7 comments

Q. Can you explain me log files in Ubuntu Linux and how do I view logs?

A. All logs are stored in /var/log directory under Ubuntu (and other Linux distro).

Linux Log files and usage

=> /var/log/messages : General log messages

=> /var/log/boot : System boot log

=> /var/log/debug : Debugging log messages

=> /var/log/auth.log : User login and authentication logs

=> /var/log/daemon.log : Running services such as squid, ntpd and others log message to this file

=> /var/log/dmesg : Linux kernel ring buffer log

=> /var/log/dpkg.log : All binary package log includes package installation and other information

=> /var/log/faillog : User failed login log file

=> /var/log/kern.log : Kernel log file

=> /var/log/lpr.log : Printer log file

=> /var/log/mail.* : All mail server message log files

=> /var/log/mysql.* : MySQL server log file

=> /var/log/user.log : All userlevel logs

=> /var/log/xorg.0.log : X.org log file

=> /var/log/apache2/* : Apache web server log files directory

=> /var/log/lighttpd/* : Lighttpd web server log files directory

=> /var/log/fsck/* : fsck command log

=> /var/log/apport.log : Application crash report / log file

To view log files at shell prompt

Use tail, more, less and grep command.
tail -f /var/log/apport.log
more /var/log/xorg.0.log
cat /var/log/mysql.err
less /var/log/messages
grep -i fail /var/log/boot

View log files using GUI tools using the GNOME System Log Viewer

System Log Viewer is a graphical, menu-driven viewer that you can use to view and monitor your system logs. System Log Viewer comes with a few functions that can help you manage your logs, including a calendar, log monitor and log statistics display. System Log Viewer is useful if you are new to system administration because it provides an easier, more user-friendly display of your logs than a text display of the log file. It is also useful for more experienced administrators, as it contains a calendar to help you locate trends and track problems, as well as a monitor to enable you to continuously monitor crucial logs.

You can start System Log Viewer in the following ways:

Click on System menu > Choose Administration > System Log:
View log files in Ubuntu Linux
(The GNOME System Log Viewer)

Note you can start the GNOME System Log Viewer from a shell prompt, by entering the following command:
$ gnome-system-log &

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 7 comments… read them below or add one }

1 Vincent Tournebise 09.27.07 at 10:19 am

When I start gnome-system-log there are no files open. I have to pick them manually.
I’m trying to view my Apache logs, old ones which are gzipped, and it won’t open them.
Do you know any *free* and simple log viewer which could do that ?

2 Name 02.06.08 at 3:52 am

“I’m trying to view my Apache logs, old ones which are gzipped, and it won’t open them.
Do you know any *free* and simple log viewer which could do that ?”

use gunzip to manually unzip them and then read them manually with gedit, vim, or something else?

please add a contact address to your comment in the future because I would be surprised if you still read this particular page this long after posting the question.

3 vivek 02.06.08 at 5:52 am

zless /path/to/apache/access.log.gz
zmore /path/to/apache/access.log.gz
zgrep /path/to/apache/access.log.gz

See this tip for more information

4 Gerry 03.07.09 at 1:37 pm

> please add a contact address to your comment in the future because I would be surprised if you still read this particular page this long after posting the question.

Hehehe, that didn’t make any sense. If the problem that you are trying to solve is that he won’t be back to read your comment, then he won’t be able to read your tip about leaving an contact details in future. Also if you though he wouldn’t be back then why did you answer his query. Adding an email to a public for is silly even if you obfuscate it. Funniest of all is that you seem to be under the impression that he would be able to predict how long it would have taken for somebody to respond.

It would have been much more logical to request that the author of this site adds a feature so that people can choose to be emailed every time a response is posted. After all, an email is required before you can leave a comment.

btw… please add a contact address to your comment in the future because I would be surprised if you still read this particular page this long after posting your comment.

5 Vivek Gite 03.07.09 at 1:46 pm

I’ve added an option to subscribe comment thread via email.

HTH

6 Gerry 10.17.09 at 4:27 pm

I had bookmarked this thread in case anybody replied and I’ve just been going through all my old bookmarks.
Nice feature add Vivek :)

7 isaaclw 01.11.10 at 6:22 am

Yeah, I’m pleased with gnome-system-log… but not quite good enough.

I’m trying to find a log viewer that still follows the logs, even after the the file get’s gzipped. (ie when “messages” gets gzipped, and a new “messages” is created, it should still keep following the new “messages”)
It’s a bit annoying to restart my log viewer (in this case tail) each time I restart a logging program like apt-proxy or squid…

I thought that maybe gnome-system-log might handle it, but gnome-system-log has other problems. It doesn’t keep scrolling… etc.

Any other ideas on logging in ubuntu? command-line is preferred…

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All