13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 11 ■ TRACKING DOWN BUGSThe first line logs all messages with priority notice and above, except for mail messages, which itdoesn’t log at all (the none priority). The second line logs all messages with facility mail and prioritynotice and above to a separate file. To extend this to news messages, use this:*.notice;mail,news.none /var/log/messagesmail.notice /var/log/mailnews.notice /var/log/newsThis now excludes the news messages from the general file as well and adds them instead to theirown log file at /var/log/news. You can treat any facility and priority similarly. Remember that youprobably want to keep a catchall file (*.priority) at /var/log/messages, even if you think you’ve brokenout all expected facilities into their own log files.Use = to log only that priority without including the ones above it:=mail.notice=mail.warn/var/log/mail.notice/var/log/mail.warnYou can also use – to avoid syncing the log file after each log entry. This is useful if you have anetwork logging host that gets logins from lots of machines.■ Note You can also send messages to a particular user. Here’s an example:auth.critadminThis will send all authorization messages of critical or above severity to the admin user.It’s useful to break out messages of particular known types to limit the amount of messages youhave to wade through in /var/log/messages when debugging, but be aware that this does also increasethe likelihood of your missing a relevant message if you’re tracking down a more complicated bug or onethat you don’t understand yet. However, equally it will make it much easier to track down a bug in, say,the mail system, if you need to look at only a single file that has all the mail messages in and nothing else.■ Note To watch /var/log/messages in real time, use tail -f /var/log/messages. This is incredibly usefulwhen debugging.225Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!