]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - misc-utils/logger.1
docs: fix two spellings in man page of logger
[thirdparty/util-linux.git] / misc-utils / logger.1
index d99c9f40cfdfd1ec058df92abba2e72556127101..ff81fce4c55a50cc7aad35d6297cd8ca78324a82 100644 (file)
 .\"
 .\"    @(#)logger.1    8.1 (Berkeley) 6/6/93
 .\"
-.\" Section on valid facility and level strings added by
-.\" and1000@debian.org, 26 Oct 1997.
-.Dd June 6, 1993
-.Dt LOGGER 1
-.Os BSD 4.3
-.Sh NAME
-.Nm logger
-.Nd a shell command interface to the syslog(3) system log module
-.Sh SYNOPSIS
-.Nm logger
-.Op Fl isd
-.Op Fl f Ar file
-.Op Fl p Ar pri
-.Op Fl t Ar tag
-.Op Fl u Ar socket
-.Op Fl n Ar server
-.Op Fl P Ar udpport
-.Op Ar message ...
-.Sh DESCRIPTION
-.Nm Logger
-makes entries in the system log.
-It provides a shell command interface to the
-.Xr syslog  3
+.TH LOGGER "1" "December 2014" "util-linux" "User Commands"
+.SH NAME
+logger \- enter messages into the system log
+.SH SYNOPSIS
+.B logger
+[options]
+.RI [ message ]
+.SH DESCRIPTION
+.B logger
+makes entries in the system log.  It provides a shell-command
+interface to the
+.BR syslog (3)
 system log module.
-.Pp
-Options:
-.Pp
-.Bl -tag -width "message"
-.It Fl i
-Log the process id of the logger process
-with each line.
-.It Fl s
-Log the message to standard error, as well as the system log.
-.It Fl f Ar file 
-Log the specified file.
-.It Fl p Ar pri 
-Enter the message with the specified priority.
-The priority may be specified numerically or as a ``facility.level''
+.sp
+When the optional \fImessage\fR argument is present, it is written
+to the log.  If it is not present, and the \fB\-f\fR option is not
+given either, then standard input is logged.
+.SH OPTIONS
+.TP
+.BR \-d , " \-\-udp"
+Use datagrams (UDP) only.  By default the connection is tried to the
+syslog port defined in /etc/services, which is often 514 .
+.TP
+.BR \-f , " \-\-file " \fIfile
+Log the contents of the specified \fIfile\fR.
+This option cannot be combined with a command-line message.
+.TP
+.BR \-i , " \-\-id" [ = \fIid ]
+Log the PID of the logger process with each line.  When the optional
+argument \fIid\fR is specified, then it is used instead of the logger
+command's PID.  The use of \fB\-\-id=$$\fR
+(PPID) is recommended in scripts that send several messages.
+.TP
+.BR \-\-journald [ =\fIfile ]
+Write a systemd journal entry.  The entry is read from the given \fIfile\fR,
+when specified, otherwise from standard input.
+Each line must begin with a field that is accepted by journald; see
+.BR systemd.journal-fields (7)
+for details.  The use of a MESSAGE_ID field is generally a good idea, as it
+makes finding entries easy.  Examples:
+.IP
+.nf
+\fB    printf \(dq%s\\n%s\\n%s\\n\(dq MESSAGE_ID=42 DOGS=bark \(dqCARAVAN=goes on\(dq | logger --journald
+\fB    logger --journald=entry.txt
+.fi
+.IP
+Notice that
+.B \-\-journald
+will ignore values of other options, such as priority.  If priority is
+needed it must be within input, and use PRIORITY field.  The simple
+execution of
+.B journalctl
+will display MESSAGE field.  Use
+.B journalctl --output json-pretty
+to see rest of the fields.
+
+.TP
+.BR \-n , " \-\-server " \fIserver
+Write to the specified remote syslog \fIserver\fR
+instead of to the builtin syslog routines.  Unless
+\fB\-\-udp\fR or \fB\-\-tcp\fR
+is specified, \fBlogger\fR will first try to use UDP,
+but if thist fails a TCP connection is attempted.
+.TP
+.BR \-P , " \-\-port " \fIport
+Use the specified \fIport\fR.  When this option is not specified, the
+port defaults to syslog for udp and to syslog-conn for tcp connections.
+.TP
+.BR \-p , " \-\-priority " \fIpriority
+Enter the message into the log with the specified \fIpriority\fR.
+The priority may be specified numerically or as a
+.IR facility . level
 pair.
-For example, ``\-p local3.info'' logs the message(s) as
-.Ar info Ns rmational
-level in the
-.Ar local3
-facility.
-The default is ``user.notice.''
-.It Fl t Ar tag 
-Mark every line in the log with the specified
-.Ar tag  .
-.It Fl u Ar sock
-Write to socket as specified with
-.Ar socket
-instead of builtin syslog routines.
-.It Fl d
-Use a datagram instead of a stream connection to this socket.
-.It Fl n Ar serv
-Write to remote syslog server using UDP as specified with
-.Ar server
-instead of builtin syslog routines.
-.It Fl P Ar port
-Change UDP port to the value as specified with
-.Ar udpport  .
-Default port number is 514.
-.It --
-End the argument list. This is to allow the
-.Ar message
+For example, \fB\-p local3.info\fR
+logs the message as informational in the local3 facility.
+The default is \fBuser.notice\fR.
+.TP
+.B \-\-prio-prefix
+Look for a syslog prefix on every line read from standard input.
+This prefix is a decimal number within angle brackets that encodes both
+the facility and the level.  The number is constructed by multiplying the
+facility by 8 and then adding the level.  For example, \fBlocal0.info\fR,
+meaning facility=16 and level=6, becomes \fB<134>\fR.
+.sp
+If the prefix contains no facility, the facility defaults to what is
+specified by the \fB\-p\fR option.  Similarly, if no prefix is provided,
+the line is logged using the \fIpriority\fR given with \fB\-p\fR.
+.sp
+This option doesn't affect a command-line message.
+.TP
+.B \-\-rfc3164
+Use the RFC 3164 BSD syslog protocol to submit messages to a remote server.
+.TP
+.BR \-\-rfc5424 [ =\fIwithout ]
+Use the RFC 5424 syslog protocol to submit messages to a remote server.
+The optional \fIwithout\fR argument can be a comma-separated list of
+the following values: \fBnotq\fR, \fBnotime\fR, \fBnohost\fR.
+The \fBnotq\fR value suppresses the time-quality structured data
+from the submitted message.  (The time-quality information shows whether
+the local clock was synchronized plus the maximum number of microseconds
+the timestamp might be off.)  The \fBnotime\fR value (which implies
+\fBnotq\fR) suppresses the complete sender timestamp that is in
+ISO-8601 format, including microseconds and timezone.
+The \fBnohost\fR value suppresses
+.BR gethostname (2)
+information from the message header.
+.IP
+The RFC 5424 protocol has been the default for
+.B logger
+since version 2.26.
+.TP
+.BR \-s , " \-\-stderr"
+Output the message to standard error as well as to the system log.
+.TP
+.BR \-T , " \-\-tcp"
+Use stream (TCP) only.  By default the connection is tried to the
+.I syslog-conn
+port defined in /etc/services, which is often
+.IR 601 .
+.TP
+.BR \-t , " \-\-tag " \fItag
+Mark every line to be logged with the specified
+.IR tag .
+.TP
+.BR \-u , " \-\-socket " \fIsocket
+Write to the specified
+.I socket
+instead of to the builtin syslog routines.
+.TP
+.B \-\-
+End the argument list.  This allows the \fImessage\fR
 to start with a hyphen (\-).
-.It Ar message
-Write the message to log; if not specified, and the
-.Fl f
-flag is not
-provided, standard input is logged.
-.El
-.Pp
+.TP
+.BR \-V , " \-\-version"
+Display version information and exit.
+.TP
+.BR \-h , " \-\-help"
+Display help text and exit.
+.SH RETURN VALUE
 The
-.Nm logger
+.B logger
 utility exits 0 on success, and >0 if an error occurs.
-.Pp
-Valid facility names are: auth, authpriv (for security information of a
-sensitive nature), cron, daemon, ftp, kern (can’t be generated from user
-process), lpr, mail, news, security (deprecated synonym for auth), syslog,
-user, uucp, and local0 to local7, inclusive.
-.Pp
-Valid level names are):
-alert, crit, debug, emerg, err, error (deprecated synonym for err),
-info, notice, panic (deprecated synonym for emerg), warning,
-warn (deprecated synonym for warning).
-For the priority order and intended purposes of these levels, see
-.Xr syslog 3 .
-.Sh EXAMPLES
-.Bd -literal -offset indent -compact
-logger System rebooted
-
-logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
-
-logger \-n loghost.example.com System rebooted
-.Ed
-.Sh SEE ALSO
-.Xr syslog 3 ,
-.Xr syslogd 8
-.Sh STANDARDS
+.SH FACILITIES AND LEVELS
+Valid facility names are:
+.IP
+.TS
+tab(:);
+left l l.
+\fBauth
+\fBauthpriv\fR:for security information of a sensitive nature
+\fBcron
+\fBdaemon
+\fBftp
+\fBkern\fR:cannot be generated from user process
+\fBlpr
+\fBmail
+\fBnews
+\fBsyslog
+\fBuser
+\fBuucp
+\fBlocal0
+  to:
+\fBlocal7
+\fBsecurity\fR:deprecated synonym for \fBauth
+.TE
+.PP
+Valid level names are:
+.IP
+.TS
+tab(:);
+left l l.
+\fBemerg
+\fBalert
+\fBcrit
+\fBerr
+\fBwarning
+\fBnotice
+\fBinfo
+\fBdebug
+\fBpanic\fR:deprecated synonym for \fBemerg
+\fBerror\fR:deprecated synonym for \fBerr
+\fBwarn\fR:deprecated synonym for \fBwarning
+.TE
+.PP
+For the priority order and intended purposes of these facilities and levels, see
+.BR syslog (3).
+.SH EXAMPLES
+.B logger System rebooted
+.br
+.B logger \-p local0.notice \-t HOSTIDM \-f /dev/idmc
+.br
+.B logger \-n loghost.example.com System rebooted
+.SH SEE ALSO
+.BR syslog (3),
+.BR syslogd (8),
+.BR journalctl (1),
+.BR systemd.journal-fields (7)
+.SH STANDARDS
 The
-.Nm logger
-command is expected to be
-.St -p1003.2
-compatible.
-.Sh AVAILABILITY
+.B logger
+command is expected to be IEEE Std 1003.2 ("POSIX.2") compatible.
+.SH AVAILABILITY
 The logger command is part of the util-linux package and is available from
-ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
+.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
+Linux Kernel Archive
+.UE .