How to View Log Messages in Linux

Almost all log files are located under /var/log directory (and subdirectory). You can change to this directory using cd command but you need to be the root user. You can use less, more, cat or tail command to see the logs.

Firt you need to go to /var/logs directory :
[code]cd /var/log[/code]
See all files and subdirectory :
Below is example files in /var/log directory, make a note that httpd, mail, and samba below is a subdirectory in /var/log
boot.log cron httpd maillog messages.1 secure.1 wtmp
boot.log.1 cron.1 lastlog maillog.1 samba spooler yum.log
btmp dmesg mail messages secure spooler.1
Then how to view common log file /var/log/messages using the following commands below:
[code]tail -f messages[/code]

In short /var/log is the location where you should find all Linux logs file. However some applications such as httpd have a directory within /var/log/httpd for their own log files.
Go to /var/log/httpd directory :
[code]cd /var/log/httpd[/code]
See all files
Example files :
access_log  access_log.1  error_log  error_log.1
The error log is usually written to a file, typically error_log
To view the httpd log :
[code]tail -f error_log[/code]

To view the other log, you just need to go to the subdirectory under /var/log
I hope this will help

Facebook Fans