LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   how to find error logs (https://www.linuxquestions.org/questions/linux-desktop-74/how-to-find-error-logs-927084/)

rajini23 02-02-2012 12:42 AM

how to find error logs
 
Hi,


I have doubt that how to find the error logs in
/var/log/messages....etc every thing will be written in that file...

how to i identify the errors on this please suggest me on this to sort out the error in log file in linux...

i use CentOS....

EricTRA 02-02-2012 01:39 AM

Hello,

What error are you looking for? If you want to filter out error messages from a specific process or a specific type of error message, you can always use grep to only show the lines containing your keyword(s). Have a look at the man page for grep:
Code:

man grep
Kind regards,

Eric

devUnix 02-03-2012 12:25 AM

You can find several log files in "/var/log" as you know. To look for warnings/errors that you are interested in, you can simply perform a "search or scan" by using "grep" command as shown below:

Code:

root@localhost ~]# grep 'error' /var/log/messages | tail -n 2
Feb  3 11:00:49 localhost NetworkManager[1226]: <error> [1328247049.314141] [nm-manager.c:1312] user_proxy_init(): could not init user settings proxy: (3) Could not get owner of name 'org.freedesktop.NetworkManagerUserSettings': no such name
Feb  3 11:00:49 localhost NetworkManager[1226]: <error> [1328247049.526871] [nm-manager.c:1312] user_proxy_init(): could not init user settings proxy: (3) Could not get owner of name 'org.freedesktop.NetworkManagerUserSettings': no such name
[root@localhost ~]#

Code:

grep "keyWord or string" fileName
Use "grep -i" to make a case-insensitive search.

Learn more by running this command:

Code:

man grep
You may want to look for application/software/service specific log files first by looking at their corresponding directories/log files inside "/var/log/".

Run this command:

Code:

dmesg | grep -i error

Code:


[root@localhost ~]# dmesg | grep -i info
EXT4-fs (sda2): INFO: recovery required on readonly filesystem
[root@localhost ~]#



All times are GMT -5. The time now is 04:45 PM.