Linux log files location and how do I view logs files?
Q. I am new to Linux and I would like to know where are the log files located under Debian or Cento OS Linux server? How do I open or view log files?
A. Almost all logfiles 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.
Go to /var/logs directory:# cd /var/logsView common log file /var/log/messages using any one of the following command:# tail -f /var/log/messagesOutput:
# less /var/log/messages
# more -f /var/log/messages
# vi /var/log/messages
Jul 17 22:04:25 router dnsprobe[276]: dns query failed Jul 17 22:04:29 router last message repeated 2 times Jul 17 22:04:29 router dnsprobe[276]: Primary DNS server Is Down... Switching To Secondary DNS server Jul 17 22:05:08 router dnsprobe[276]: Switching Back To Primary DNS server Jul 17 22:26:11 debian -- MARK -- Jul 17 22:46:11 debian -- MARK -- Jul 17 22:47:36 router -- MARK -- Jul 17 22:47:36 router dnsprobe[276]: dns query failed Jul 17 22:47:38 debian kernel: rtc: lost some interrupts at 1024Hz. Jun 17 22:47:39 debian kernel: IN=eth0 OUT= MAC=00:0f:ea:91:04:07:00:08:5c:00:00:01:08:00 SRC=61.4.218.24 DST=192.168.1.100 LEN=60 TOS=0x00 PREC=0x00 TTL=46 ID=21599 DF PROTO=TCP SPT=59297 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0
Common log files name and usage
- /var/log/message: Genreal message and system releated stuff
- /var/log/auth.log: Authenication logs
- /var/log/kern.log: Kernel logs
- /var/log/cron.log: Crond logs
- /var/log/maillog: Mail logs
- /var/log/qmail/ : Qmail log directory (more files inside this directory)
- /var/log/httpd/: Apache access and error logs directory
- /var/log/lighttpd: Lighttpd access and error logs directory
- /var/log/boot.log : System boot log
- /var/log/mysqld.log: MySQL database server log file
- /var/log/secure: Authentication log
- /var/log/utmp or /var/log/wtmp : Login records file
- /var/log/yum.log: Yum log files
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/ for their own log files. You can roatate log file using logrotate software and monitor logs files using logwatch software.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Linux / UNIX FAQ:
- View log files in Ubuntu Linux
- Linux View / display a logfile in real time on screen
- Squid Proxy Sever View logs / log files
- How do I rotate log files?
- How do I find all the files owned by a particular user or group?
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!
Tags: debian kernel, error logs, log directory, log files, log messages, mail logs ~ Last updated on: November 11, 2007



May 28th, 2007 at 1:18 pm
Very informative. Helped me
thumbs up
July 11th, 2007 at 6:19 am
dear talent,
Can u help me how to redirect the /var/log/messages to email.
DNS server if any clients query log will stores /var/log/messages files i need to send those lof files in ip wise daily or weekly.
how shell i do it.
October 29th, 2007 at 9:28 pm
Dear Vivek,
I had an automatic reboot system in my server linux and I don“t find any evidence about the cause that could produce that.
Can you explain me where I have to looking for logs of error that guide me to find automatic reboot cause?.
Regards,
Gonzalo R.
January 31st, 2008 at 4:25 am
where can i find the AT command logs. how to find out when the last time AT command run.