White Paper: Initscripts & logging


< Prev Contents Next >

What Does this?

Red Hat Linux 6.0 achieves these goals through the use of two programs, initlog and minilogd, plus a lot of shell scripting around them.

initlog
initlog is a logging program similar to logger. It is used to log various items to the system syslog daemon, whatever that might be. It can be operated in multiple ways:

  • If passed a command line with the -c parameter, initlog will execute the specified command, logging anything output of that command;
  • If passed a string with the -s option, initlog will log that string to the system logger;
  • If passed an event with the -e parameter, initlog will log that a particular event occured.
  • Currently specified events include:
    • a command completed successfully;
    • a command failed;
    • a command was canceled at the users request;
    • a command failed due to the failure of a dependent action.
  • If passed a command line with the -r parameter, initlog will execute the specified command, leaving a pipe open to the command on which it can pass back further commands to initlog.

When it recieves data to log, initlog goes through a simple heiruistic to determine what to do with the data.

  1. Check for the existence of /dev/log. If so, log the data via the C library's syslog() routine.
  2. Attempt to start a mini-syslog daemon, minilogd. If successful, log via syslog().
  3. Store the data in a local buffer, and try again when more data is recieved.

minilogd
minilogd is a simple syslog daemon. It listens on the local socket /dev/log, and collects data received by standard system log mechanisms. It stores the data in a local buffer.

If another log daemon, such as syslogd, starts, it will remove the /dev/log socket from minilogd, and create one of its own. When this happens, minilogd will flush its data to the new daemon, and exit.


< Prev Contents Next >