Difference between revisions of "Logger (command)"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
Line 3: Line 3:
  
 
== Basic Usage ==
 
== Basic Usage ==
* <code>logger -s "Message"</code>
+
::<code>logger -s "Message"</code>
 
:: <code>-s, --stderr</code> Output the message to standard error as well as to the system log.
 
:: <code>-s, --stderr</code> Output the message to standard error as well as to the system log.
  
 
  logger --server 10.10.x.x  "TEST"
 
  logger --server 10.10.x.x  "TEST"
  
*<code>[[echo]] "MY TEXT TO LOG" | logger -s</code>
+
::<code>[[echo]] "MY TEXT TO LOG" | logger -s</code>
 
::<code> -s, --stderr</code> Output the message to standard error as well as to the system log.
 
::<code> -s, --stderr</code> Output the message to standard error as well as to the system log.
  

Revision as of 12:24, 12 April 2021

Linux[1] (bsdutils package) and most BSDs including MacOS provide logger command line utility to send messages to syslog, locally or to a remote syslog server. Many languages provide support for writing messages to syslog, such as go: https://godoc.org/github.com/spkg/slog.


Basic Usage

logger -s "Message"
-s, --stderr Output the message to standard error as well as to the system log.
logger --server 10.10.x.x  "TEST"
echo "MY TEXT TO LOG" | logger -s
-s, --stderr Output the message to standard error as well as to the system log.


logger -n SERVER.DOMAIN.COM -T  "TEST
logger: failed to resolve name SERVER.DOMAIN.COM port syslog-conn: Servname not supported for ai_socktype
 logger -n SERVER.DOMAIN.COM -T -P 514 "TEST

Activities

  1. Log messages to a different file using rsyslog and logger command[2]


Related terms

See also

Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.

Original Source: https://en.wikiversity.org/wiki/Linux_Administration/System_Services/System_Logging/logger

Advertising: