Linux Error Log Location
Contents |
2014 in Commands, File system, LinuxI am a new Linux user. I would like to know where are linux /var/log/messages the log files located under Debian/Ubuntu or CentOS/RHEL/Fedora Linux server?
Linux Log Files Explained
How do I open or view log files on Linux operating systems? Almost all logfiles are how to check logs in linux server located under /var/log directory and its sub-directories on Linux. You can change to this directory using the cd command. You need be the root user to
How To View Logs In Linux Command Line
view or access log files on Linux or Unix like operating systems. You can use the following commands to see the log files:less commandmore commandcat commandgrep commandtail commandzcat commandzgrep commandzmore commandHow do I view log files on Linux?Open the Terminal or login as root user using ssh command. Go to /var/log directory using what is /var/log/messages the following cd command: # cd /var/log
To list files use the following ls command: # ls Sample outputs from RHEL 6.x server:anaconda.ifcfg.log boot.log-20111225 cron-20131110.gz maillog-20111218 messages-20131103.gz secure-20131027.gz spooler-20131117.gz up2date-20131117.gz anaconda.log btmp cron-20131117.gz maillog-20111225 messages-20131110.gz secure-20131103.gz squid uptrack.log anaconda.program.log btmp-20120101 cups maillog-20120101 messages-20131117.gz secure-20131110.gz swinstall.d uptrack.log.1 anaconda.storage.log btmp-20131101.gz dkms_autoinstaller maillog-20131027.gz mysqld.log secure-20131117.gz tallylog uptrack.log.2 anaconda.syslog collectl dmesg maillog-20131103.gz ntpstats setroubleshoot UcliEvt.log varnish anaconda.yum.log ConsoleKit dmesg.old maillog-20131110.gz prelink spooler up2date wtmp arcconfig.xml cron dracut.log maillog-20131117.gz rhsm spooler-20111211 up2date-20111211 yum.log atop cron-20111211 dracut.log-20120101 messages sa spooler-20111218 up2date-20111218 yum.log-20120101 audit cron-20111218 dracut.log-20130101.gz messages-20111211 secure spooler-20111225 up2date-20111225 yum.log-20130101.gz boot.log cron-20111225 httpd messages-20111218 secure-20111211 spooler-20120101 up2date-20120101 boot.log-20111204 cron-20120101 lastlog messages-20111225 secure-20111218 spooler-20131027.gz up2date-20131027.gz boot.log-20111211 cron-20131027.gz maillog messages-20120101 secure-20111225 spooler-20131103.gz up2date-20131103.gz boot.log-20111218 cron-20131103.gz maillog-20111211 messages-20131027.gz secure-20120101 spooler-20131110.gz up2date-20131110.gz To view a common log file called /var/log/messages use any one of the following command: # less /var/log/messages# more -f /var/log/messages
# cat /var/log/messages
# tail -f /var/log/messages
# grep
know where the log files are located, and what is contained in each and every log file. When your systems are running smoothly, take some time
Linux Log Command
to learn and understand the content of various log files, which will help
/var/log/syslog
you when there is a crisis and you have to look though the log files to identify the issue. /etc/rsyslog.conf controls how to view log files in linux what goes inside some of the log files. For example, following is the entry in rsyslog.conf for /var/log/messages. $ grep "/var/log/messages" /etc/rsyslog.conf *.info;mail.none;authpriv.none;cron.none /var/log/messages In the above output, *.info indicates that all logs http://www.cyberciti.biz/faq/linux-log-files-location-and-how-do-i-view-logs-files/ with type INFO will be logged. mail.none,authpriv.none,cron.none indicates that those error messages should not be logged into the /var/log/messages file. You can also specify *.none, which indicates that none of the log messages will be logged. The following are the 20 different log files that are located under /var/log/ directory. Some of these log files are distribution specific. For example, you'll see dpkg.log on Debian based systems http://www.thegeekstuff.com/2011/08/linux-var-log-files/ (for example, on Ubuntu). /var/log/messages - Contains global system messages, including the messages that are logged during system startup. There are several things that are logged in /var/log/messages including mail, cron, daemon, kern, auth, etc. /var/log/dmesg - Contains kernel ring buffer information. When the system boots up, it prints number of messages on the screen that displays information about the hardware devices that the kernel detects during boot process. These messages are available in kernel ring buffer and whenever the new message comes the old message gets overwritten. You can also view the content of this file using the dmesg command. /var/log/auth.log - Contains system authorization information, including user logins and authentication machinsm that were used. /var/log/boot.log - Contains information that are logged when the system boots /var/log/daemon.log - Contains information logged by the various background daemons that runs on the system /var/log/dpkg.log - Contains information that are logged when a package is installed or removed using dpkg command /var/log/kern.log - Contains information logged by the kernel. Helpful for you to troubleshoot a custom-built kernel. /var/log/lastlog - Displays the recent login information for all the users. This is not an ascii file. You should use lastlog command to view the
and Logs Linux maintains several system logs that help you administer a Linux system by informing you of important events. Probably http://www.oreilly.com/openbook/debian/book/ch07_04.html the most important log is the file /var/log/messages, which records a variety of events, including system error messages, system startups, and system shutdowns. Like most other Linux https://www.digitalocean.com/community/tutorials/how-to-view-and-configure-linux-logs-on-ubuntu-and-centos files, the file contains ASCII text, so you can view it with a text editor or the text processing commands described in Chapter 13. A special command, how to dmesg, makes it easy to view the log messages related to the most recent system startup. If your system is behaving unusually, use dmesg to quickly see if something went wrong during the system startup sequence. Of course, you must have some way of determining what's usual and unusual among the many messages emitted during logs in linux system startup. The best way to do so is to print the output of the dmesg command and keep it on hand for comparison with suspicious output. If your system has an attached printer, you can print the output of dmesg by entering the following command: dmesg | lpr Other logs found in the /var/log directory include: apache A directory that contains two log files pertaining to the Apache web server, access.log and error.log. exim A directory that contains several log files pertaining to the exim mail transfer agent. nmb and smb Files that contain log entries pertaining to Samba, the Microsoft-compatible networking server. ppp.log A file the contains log entries pertaining to PPP. 7.3 Starting and Stopping the System and Services 7.5 Setting the System Time and Time Zone Back to: Learning Debian GNU/Linux oreilly.com Home | O'Reilly Bookstores | How to Order | O'Reilly Contacts International | About O'Reilly | Affiliated Companies | Privacy Policy © 2001, O'Reilly & Associates, Inc.
In submit Tutorials Questions Projects Meetups Main Site logo-horizontal DigitalOcean Community Menu Tutorials Questions Projects Meetups Main Site Sign Up Log In submit View All Results By: Sadequl Hussain Subscribe Subscribed Share Contents Contents We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more → 9 How To View and Configure Linux Logs on Ubuntu and Centos Posted Dec 17, 2013 166.4k views Logging Linux Basics CentOS Ubuntu Debian Introduction Linux system administrators often need to look at log files for troubleshooting purposes. In fact, this is the first thing any sysadmin would do. Linux and the applications that run on it can generate all different types of messages, which are recorded in various log files. Linux uses a set of configuration files, directories, programs, commands and daemons to create, store and recycle these log messages. Knowing where the system keeps its log files and how to make use of related commands can therefore help save valuable time during troubleshooting. In this tutorial, we will have a look at different parts of the Linux logging mechanism. Disclaimer The commands in this tutorial were tested in plain vanilla installations of CentOS 6.4, Ubuntu 12 and Debian 7. Default Log File Location The default location for log files in Linux is /var/log. You can view the list of log files in this directory with a simple ls -l /var/log command. This is what I see in my CentOS system: [root@TestLinux ~]# ls -l /var/log total 1472 -rw-------. 1 root root 4524 Nov 15 16:04 anaconda.ifcfg.log -rw-------. 1 root root 59041 Nov 15 16:04 anaconda.log -rw-------. 1 root root 42763 Nov 15 16:04 anaconda.program.log -rw-------. 1 root root 299910 Nov 15 16:04 anaconda.storage.log -rw-------. 1 root root 40669 Nov 15 16:04 anaconda.syslog -rw-------. 1 root root 57061 Nov 15 16:04 anaconda.xlog -rw-------. 1 root root 1829 Nov 15 16:04 anaconda.yum.log drwxr-x---. 2 root root 4096 Nov 15 16:11 audit -rw-r--r-- 1 root root 2252 Dec 9 10:27 boot.log -rw------- 1 root utmp 384 Dec 9 10:31 btmp -rw-------. 1 root utmp 1920 Nov 28 09:28 btmp-20131202 drwxr-xr-x 2 root root 4096 Nov 29 15:47 ConsoleKit -rw------- 1 root root 2288 Dec 9 11:01 cron -rw-------. 1 root root 8809 Dec 2 17:09 cron-20131202 -rw-r--r-- 1 root root 21510 Dec 9 10:27 dmesg -rw-r--r-- 1 root root 21351 Dec 6 16:37 dmesg.old -rw-r--r--. 1 root root 165665 Nov 15 16:04 dracut.log -rw-r--r--. 1 root root 146876 Dec 9 10:44 l