Reviewing /var/log/messages

The log /var/log/messages shows most system messages, and as such it is useful for debugging all sorts of problems. …

Most system messages go to /var/log/messages: non-kernel boot errors, messages from most application-level services, post-boot kernel messages, and more are written to this file. While there are many specialized log files on a Linux box, /var/log/messages is a good first place to look whether troubleshooting or simply making sure that all is in order.

On Ubuntu 11.4 and later, substitute /var/log/syslog for /var/log/messages.

/var/log/messages is not world-readable; you need root privileges to view it.

The log is organized chronologically, newest entries last. So to view the most recent messages, tail -50 /var/log/messages, replacing 50 with however many messages you want to see. You might use this to see what was logged a moment ago.

To view the entire log, less /var/log/messages. If you prefer to open it in a text editor, you will be continually interrupted by warnings that the original file has changed unless you first copy the log, then open the copy. For example:

# cp /var/log/messages /tmp/ & bluefish /tmp/messages &

To view current messages in real time, tail -f /var/log/messages. Messages will now scroll by as logged until stopped with Ctrl-C. You might use this to see what is logged as you perform an action.

Consider adding /var/log/messages to your backup set as an aid to future diagnostics. Don't do this if you use a sync-based backup: being ever-changing, the file can overrun your storage medium.


About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

One Response to Reviewing /var/log/messages

  1. Pingback: Security and stability tuning on Linux | A maze of twisty little passages

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s