Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ syslog(3) — Amiga System V Release 4 Version 2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

logger(1)

login(1)

lpr(1)

lpc(1M)

syslogd(1M)

printf(3S)

at(1)

crontab(1)

login(1)

ftpd(1M)

routed(1M)

syslog(3)

getty(1M)

cron(1M)

su(1)

printf(3S)



syslog(3)              C LIBRARY FUNCTIONS              syslog(3)



NAME
     syslog, openlog, closelog, setlogmask - control system log

SYNOPSIS
     cc [ flag... ] file ... -lucb
     #include <syslog.h>
     openlog(ident, logopt, facility)
     char *ident;
     syslog(priority, message, parameters ... )
     char *message;
     closelog()
     setlogmask(maskpri)

DESCRIPTION
     syslog passes message to syslogd(1M), which logs  it  in  an
     appropriate  system  log,  writes  it to the system console,
     forwards it to a list of users, or forwards it to  the  sys-
     logd  on  another  host  over  the  network.  The message is
     tagged with a priority of priority.  The message looks  like
     a  printf(3S)  string  except  that  %m  is  replaced by the
     current error message (collected from  errno).   A  trailing
     NEWLINE  is  added  if  needed.  Priorities are encoded as a
     facility and a level.  The facility describes  the  part  of
     the  system  generating  the message.  The level is selected
     from an ordered list:

          LOGEMERG           A panic condition.   This  is  nor-
                              mally broadcast to all users.

          LOGALERT           A   condition   that   should    be
                              corrected  immediately,  such  as a
                              corrupted system database.

          LOGCRIT            Critical conditions, such  as  hard
                              device errors.

          LOGERR             Errors.

          LOGWARNING         Warning messages.

          LOGNOTICE          Conditions that are not error  con-
                              ditions,  but that may require spe-
                              cial handling.

          LOGINFO            Informational messages.

          LOGDEBUG           Messages that  contain  information
                              normally of use only when debugging
                              a program.
     If special processing is needed, openlog can  be  called  to
     initialize  the  log  file.  The parameter ident is a string
     that is prepended to every message.  logopt is a  bit  field



             Last change: BSD Compatibility Package             1





syslog(3)              C LIBRARY FUNCTIONS              syslog(3)



     indicating logging options.  Current values for logopt are:

          LOGPID             Log the process ID with  each  mes-
                              sage.  This is useful for identify-
                              ing specific daemon processes  (for
                              daemons that fork).

          LOGCONS            Write messages to the  system  con-
                              sole if they cannot be sent to sys-
                              logd.  This option is safe  to  use
                              in  daemon  processes  that have no
                              controlling terminal, since  syslog
                              forks before opening the console.

          LOGNDELAY          Open  the  connection  to   syslogd
                              immediately.   Normally the open is
                              delayed until the first message  is
                              logged.   This  is  useful for pro-
                              grams that need to manage the order
                              in which file descriptors are allo-
                              cated.

          LOGNOWAIT          Do not  wait  for  child  processes
                              that  have  been forked to log mes-
                              sages  onto  the   console.    This
                              option  should be used by processes
                              that enable notification  of  child
                              termination  using  SIGCHLD,  since
                              syslog may otherwise block  waiting
                              for  a  child whose exit status has
                              already been collected.
     The facility parameter encodes  a  default  facility  to  be
     assigned to all messages that do not have an explicit facil-
     ity already encoded:

          LOGKERN            Messages generated by  the  kernel.
                              These  cannot  be  generated by any
                              user processes.

          LOGUSER            Messages generated by  random  user
                              processes.   This  is  the  default
                              facility  identifier  if  none   is
                              specified.

          LOGMAIL            The mail system.

          LOGDAEMON          System daemons, such  as  ftpd(1M),
                              routed(1M), etc.

          LOGAUTH            The      authorization      system:
                              login(1), su(1), getty(1M), etc.




             Last change: BSD Compatibility Package             2





syslog(3)              C LIBRARY FUNCTIONS              syslog(3)



          LOGLPR             The line printer  spooling  system:
                              lpr(1), lpc(1M), etc.

          LOGNEWS            Reserved  for  the  USENET  network
                              news system.

          LOGUUCP            Reserved for the  UUCP  system;  it
                              does not currently use syslog.

          LOGCRON            The cron/at  facility;  crontab(1),
                              at(1), cron(1M), etc.

          LOGLOCAL0-7        Reserved for local use.
     closelog can be used to close the log file.  setlogmask sets
     the  log  priority  mask to maskpri and returns the previous
     mask.  Calls to syslog with a priority not  set  in  maskpri
     are  rejected.   The  mask for an individual priority pri is
     calculated by the macro  LOGMASK(pri);  the  mask  for  all
     priorities  up to and including toppri is given by the macro
     LOGUPTO(toppri).  The default allows all priorities  to  be
     logged.

EXAMPLE
     This call logs a message at priority LOGALERT:
          syslog(LOG_ALERT, "who: internal error 23");
     The FTP daemon, ftpd, would make this  call  to  openlog  to
     indicate  that all messages it logs should have an identify-
     ing string of ftpd, should be treated by  syslogd  as  other
     messages  from  system  daemons  are, and should include the
     process ID of the process logging the message:
          openlog("ftpd", LOG_PID, LOG_DAEMON);
     Then it would make the following call to setlogmask to indi-
     cate  that  messages  at  priorities  from LOGEMERG through
     LOGERR should be logged, but that no messages at any  other
     priority should be logged:
          setlogmask(LOGUPTO(LOG_ERR));
     Then, to log a message at priority LOGINFO, it  would  make
     the following call to syslog:
          syslog(LOGINFO,  "Connection  from  host   %d",   Cal-
          lingHost);
     A locally-written utility could use the  following  call  to
     syslog  to log a message at priority LOGINFO, to be treated
     by syslogd as other messages to the facility LOGLOCAL2  are
     treated:
          syslog(LOGINFO|LOGLOCAL2, "error: %m");

SEE ALSO
     logger(1),   login(1),   lpr(1),    lpc(1M),    syslogd(1M),
     printf(3S)  at(1), crontab(1), login(1) in the User's Refer-
     ence Manual.
     ftpd(1M),   routed(1M)   in   the   Network    User's    and
     Administrator's Guide.



             Last change: BSD Compatibility Package             3





syslog(3)              C LIBRARY FUNCTIONS              syslog(3)



     getty(1M),  cron(1M),  su(1),  printf(3S)  in   the   System
     Administrator's Reference Manual.





















































             Last change: BSD Compatibility Package             4



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026