![Forrest logo](/images/logo.png)
logger:tldr:690d2
logger: Send the output to a remote syslog server running at a given port. Default port is 514.
$ echo ${log_entry} | logger --server ${hostname} --port ${port}
try on your machine
This command is used to send a log entry to a remote logging server using the logger
utility.
${log_entry}
is a variable that represents the log entry to be sent. It is enclosed within${}
to indicate that it is a variable.echo ${log_entry}
is a command that prints the value of${log_entry}
to the standard output.- The
|
(pipe) symbol is used to redirect the standard output of the preceding command to the standard input of the following command. logger
is a command-line utility in Unix-like operating systems that sends messages to the system log or a remote logging server.--server ${hostname}
is an option for thelogger
utility that specifies the hostname or IP address of the logging server. The value of${hostname}
is the variable representing the hostname or IP address of the server where the log entry will be sent.--port ${port}
is an option for thelogger
utility that specifies the port number of the logging server. The value of${port}
is the variable representing the port number where the log entry will be sent.
Therefore, when this command is executed, it prints ${log_entry}
to the standard output and then pipes it to the logger
command. The logger
command sends the log entry to the specified logging server (${hostname}:${port}
).
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.