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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 11 ■ TRACKING DOWN BUGS11-7. Performing Centralized Logging with syslogIt’s also possible to centralize your system logging, setting up a single log host to receive messages fromall machines. This has the advantage that if the remote machine is attacked, the attacker won’t be able todelete the logs from the central loghost; it can also have security implications, depending on how you setit up. As ever, be aware of the possibilities for attack.It’s wise to carry on logging locally, as well, so that if there’s a problem with a particular machine,you don’t have to wade through all the remote logs to identify it.First, set up syslogd on your log host to receive remote messages. On Debian/Ubuntu, edit the/etc/init.d/sysklogd file so that the SYSLOGD line near the top reads as follows:SYSLOGD="-r"■ Note To also remove the MARK lines from the files, use SYSLOGD="-r -m0".Now restart the syslog daemon (/etc/init.d/sysklogd restart).On the remote (client) machine, edit /etc/syslog.conf to specify which messages you want to sendto the logging host. You probably want just to add this line, rather than replacing the existing lines, asdiscussed earlier:*.err@loghost.example.comRestart syslogd on the client machine (/etc/init.d/sysklogd restart).Log messages from your client machine should now be recorded on the log host. Note that themessages will be filtered twice: once on the client machine (with the setup given here, messages fromany source with a priority of err or above will make it through) and then again on the log host, wherethey’ll be treated as any other incoming syslog message and filtered to a particular log file depending onthe settings in /etc/syslog.conf. So, mail messages would (assuming this was set up as in recipe 11-6)be filtered to the mail log file on the remote host, and so on. Unfortunately, there’s no way of filteringmessages from a particular host at this point; you’ll have to use grep on the log files.■ Note Another option is syslog-ng if you have very complicated logging requirements.11-8. Plotting Log Data to Locate <strong>Problem</strong>s: perl and gnuplotIf you want ongoing visualization of log data, you probably want to look at a tool like Cacti or one of theother tools built on RRDTool, rather than building your own data plot. However, sometimes you’remonitoring something specific and need to get a quick visualization of the output, perhaps to identifywhether there is a real problem.226Download at WoweBook.Com

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

Saved successfully!

Ooh no, something went wrong!