In the last post we talked about how syslog is the central method for logging messages. It really saves us from having to search all over the system for logs and it also lets the developer log messages without writing their own way of doing it.
Now for the big question, what does syslog do with all those messages?
That’s a good question, we still don’t want to be searching for those messages on our Linux® system.
Luckily for us, syslog has a configuration file that tells us everything we need to know. That file is often in /etc/syslog.conf, but depending on your system, it might be somewhere else. Check the man page for syslogd (that’s the actual program that does the logging) and it will tell you where the file is. No matter where it’s located, it bas the same purpose. To tell you where messages are put, based on the priority or the facility.
We know what the priority is, we saw that last time. What’s the facility? That’s the purpose of the program making the log message. For example, if e-mail is logging, then the facility is mail. If the Linux® kernel is logging, then the facility is kernel.
We know that emerg messages are ‘OH NO THE SYSTEM IS GOING DOWN’, so we probably want to see those on the screen, not shoved away to a log file. The configuration that does that looks like:
*.emerg /dev/console
What about mail messages? Those we would like to put in a file. It ‘s standard on most Linux® systems to put log messages in /var/log/. So we’ll put all our messages from the mail system in one place.
mail.* /var/log/mail
You can get really complex with the configurations, you want to put mail.debug in one place, mail.alert somewhere else, then you can also put duplicates of everything in a third. Or you can just stick them all in one place. The person running the system usually decides this and often the decision is made to leave the defaults alone. What are the defaults? Those are the configurations that the system has when everything is first installed.