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,
see Syslog in The GNU C Library Reference Manual.
logger [option…] [message]
Use IPv4 as transport when logging to a host. The default behaviour is to use whatever IP version that matches the host.
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.
Log the content of the specified file. If file is ‘-’ then standard input is assumed.
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
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]).
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.
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.
Log the message to standard error, as well as to the system log.
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.
Mark every line in the log with the specified tag.
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.
The following examples illustrate the usage of the
logger System rebooted
command 2>&1 | logger -p local0.err -t cmd
logger -p daemon.warn -h logger.runasimi.org -S 10.10.10.1 \ --file warnings