manpagez: man pages & more
info inetutils
Home | html | info | man

File: inetutils.info,  Node: logger invocation,  Next: ping invocation,  Prev: ifconfig invocation,  Up: Top

6 'logger': Send messages to system log
***************************************

'logger' is a program to send entries to system log.  It provides a
shell command interface similar to the system log module.  For
background information, *note Syslog: (libc)Syslog.

Synopsis:

     logger [OPTION...] [MESSAGE]

6.1 Command line options
========================

'-4'
'--ipv4'
     Use IPv4 as transport when logging to a host.  The default
     behaviour is to use whatever IP version that matches the host.

'-6'
'--ipv6'
     Use IPv6 as transport when logging to a host.  The option is
     present also on systems without support for IPv6, but will then
     issue a warning and then fall back to IPv4 when delivering the
     message.

     Both options are most influencial when the target host is named
     using a symbolic name, but numerical addresses for host or source
     must also match if either of '--ipv4' or '--ipv6' is stated.

'-f FILE'
'--file=FILE'
     Log the content of the specified file.  If FILE is '-' then
     standard input is assumed.

'-h HOST'
'--host=HOST'
     Send messages to the given host or socket.  The HOST argument can
     be either a local UNIX socket name (containing a slash '/'), or be
     of the form

          HOST[:PORT]

     where HOST is the remote host name or IP address, and the optional
     PORT is a decimal port number or symbolic service name from
     '/etc/services'.  If PORT is not specified, the port number
     corresponding to the 'syslog' service is used.  If a numerical IPv6
     address is given without a port specification, then the address
     must be enclosed within brackets (like [::1]).

'-i[PID]'
'--id=[PID]'
     Add process ID to each message.  If PID is not supplied, use the
     process ID of the logger process with each line.  Notice, that PID
     is an optional argument.  When supplied to the '-i' option, it must
     follow the 'i' letter immediately, without any separating
     whitespace.  When supplied to the '--id' form, it must be separated
     from it by exactly one equals sign.

'-p PRIORITY'
'--priority=PRIORITY'
     Enter the message with the specified priority.  The priority may be
     specified numerically or as a 'facility.level' pair.  For example,
     '-p local3.info' logs the message at the informational level in the
     'local3' facility.  The default is 'user.notice'.

     The actual list of supported facilities and levels is system
     specific.

'-s'
'--stderr'
     Log the message to standard error, as well as to the system log.

'-S ADDR'
'--source=ADDR'
     Supply the source IP address for INET connections.  This option is
     useful in conjunction with '--host' (see above).  The kind of
     address specified here (IPv4 or IPv6) will propagate to influence
     the resolution of the host address, if it is a symbolic name.

'-t TAG'
'--tag=TAG'
     Mark every line in the log with the specified tag.

'-u SOCKET'
'--unix=SOCKET'
     Send messages to the given local UNIX socket.  The SOCKET argument
     can be either an absolute path (starting with a slash '/'), or a
     relative path understood relative to the current working directory.

   The options are followed by the message which should be written to
the log.  If not specified, and the '-f' flag is not provided, standard
input is logged.

6.2 Examples
============

The following examples illustrate the usage of the 'logger' command:

  1. Log the message 'System rebooted' to the local syslog.  Use default
     facility and priority:

          logger System rebooted

  2. Run command and send its error output to the channel 'local0.err'.
     Mark each message with tag 'cmd':

          command 2>&1 | logger -p local0.err -t cmd

  3. Log each line from file 'warnings' to channel 'daemon.warn' on host
     'logger.runasimi.org', using the source IP '10.10.10.1':

          logger -p daemon.warn -h logger.runasimi.org -S 10.10.10.1  \
                 --file warnings
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.