Linux Log Files

Anyone serious about Linux will have to familiarise themselves with one of the most important aspects of it, the Linux log files. Today I'm going to try and help you understand what some of the most important log files store and where to find them.

Log files are great for helping you deduce what is going on with a system. I won’t cover all of the log files as there are too many to wade through, however I will hopefully get you started on what will hopefully become a long history of too much information.

dmesg

When I have a problem (particularly when I'm attaching a USB device and need to know its physical location /dev/...) one of the first places I go to is the dmesg command. dmesg examins or controls the kernel ring buffer which stores low level information you don't see when your system is booting.

......@hades ~ $ dmesg | less

Please note that the output of dmesg is quite long and will scroll by very quickly. Hence why I always pipe it through the less command which allows me to scroll the output one line at a time.


/var/log

This on the other hand is not a log file as such but a directory full of information gathered by your system. By all means wade through the directory yourself but notice some of the more useful log files below.
  • boot.log - Boot logtail
  • cron - Cron jobs log
  • cups - Printing log
  • httpd - Apache log
  • mail - Mail server log
  • maillog - Mail log
  • messages - Post-boot kernel information
  • secure - Security log
  • Xorg.0.log - X server log
Note the handiest way to view these log files is by using either the tail or tailf commands. Tail prints the last part (10 lines by default) of each file while tailf similarly prints out the last part of each file but then waits for the file to grow without affecting the access time of the file when it is not being updated.

There you have it too much information, however once again one of the most important aspects of Linux are the log files and you must get used to reading them and making sense from them if you are to progress with Linux. Be patient as patients is a virtue and so is Linux.

No comments:

Post a Comment