View log files in Ubuntu Linux

by on August 2, 2007 · 18 comments· LAST UPDATED August 2, 2007

in , ,

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 &

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 18 comments… read them below or add one }

1 Vincent Tournebise September 27, 2007 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 ?

Reply

2 Name February 6, 2008 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.

Reply

3 nixCraft February 6, 2008 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

Reply

4 Gerry March 7, 2009 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.

Reply

5 nixCraft March 7, 2009 at 1:46 pm

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

HTH

Reply

6 Gerry October 17, 2009 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 :)

Reply

7 isaaclw January 11, 2010 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…

Reply

8 chiranjeevi July 6, 2010 at 6:12 pm

hi,

I am using the ubuntu 10.04 Version, its been running very nice till today. Suddenly i am having a prob with my log in. So before this I did education for ubuntu had installed and again removed myself. After that as usual when I started my system the log in page rendered and I entered the user name and password but it was not leading me in to the desktop again the same log in page has been rendered. I haven’t understood what was the problem. I have been anticipating that some important files also were removed when i uninstalled that education for ubuntu. If any one knows whats the problem is please guide me with your knowledge to overcome this problem.

Reply

9 jzacsh August 23, 2010 at 12:44 pm

Is there a command line version of this? I’m thinking something with an ncurses interface has _got_ to exist for this.

Reply

10 Raja September 30, 2010 at 3:37 am

how can i check the recent works done in my system i mean watching ,playing ,docs viewed….like this
i am using ubuntu linux(10.04)
please

Reply

11 Naveen March 9, 2013 at 5:09 pm

go to places and then click on recent documents

Reply

12 isaaclw September 30, 2010 at 8:32 am

@myself.

Tail -F is exactly what I needed.

Reply

13 Tyler Oderkirk February 7, 2011 at 11:06 pm

@jzacsh @isaaclw –

For CLI/Curses log monitoring apps check out…

The latter two have “show me only unexpected entries” features.

-Tyler

Reply

14 jzacsh February 9, 2011 at 12:19 am

@Tyler Oderkirk, thanks! I’ve since found that passing multiple file arguments to `tail` suits my needs. eg.: `tail -f /var/log/httpd/.log`

Reply

15 aytug gunay May 19, 2011 at 11:30 am

How can access to log files in apache web server, without any permission!!!!

Reply

16 giouxou December 6, 2011 at 1:28 pm

Hey you.. How can i find the log files if i’m not the root user?

Reply

17 Mark March 30, 2012 at 3:09 pm

In Ubuntu 10.04, you can access the log files as a normal user. Also, in Ubuntu 10.04, the Gnome gui log viewer will open the .gz (gzipped) older log files.

Reply

18 Rashid December 16, 2012 at 9:44 am

Hi Vivek,

From where I can find the GUI related logs.
e.g. if I open the Users & Groups under the system tab and add the user or delete the user,
From where I can see this activity.

Please respond me at your earliest.

Reply

Leave a Comment

Tagged as: , , , , , ,

Previous Faq:

Next Faq: