Showing posts with label real time issue in linux. Show all posts
Showing posts with label real time issue in linux. Show all posts

Thursday, September 20, 2012

How to view system log messages in unix?

Q. where are the log files are  located under redhat or  Debian or Cento OS Linux server? How do I open or view log files? 

 Almost all log files are located under /var/log directory (and subdirectory). You can change to this directory using cd command. You can use less, more, cat or tail command to see the logs.  To Go to /var/logs directory:

# cd  /var/log/

# ls

To View common log file /var/log/messages using any one of the following command: 


# tail -f /var/log/messages, used in real time, it will show last 10 logs

# less /var/log/messages


# more /var/log/messages, we can see page page, press Tab to toggle between pages.


# vi /var/log/messages , to see in vi editor



# cat /var/log/messages


 Q. what is the use of log messages?

  • logs are used to see the status of your system. which provides the error messages and services return messages
  • with the help of logs we can trouble shoot the system erors
Linux Log files and usage

/var/log/dmesg  --> used for kernel boot messages

/var/log/messages  --> stores the standard system error messages

/var/log/maillog  --> mail system messages


/var/log/secure -->  security , authentication messages

/var/log/audit/audit.log -->  kernel auditing messages

var/log/debug -->Debugging log messages


 /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