Difference between revisions of "Logger (command)"
Jump to navigation
Jump to search
(19 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Linux<ref>http://man7.org/linux/man-pages/man1/logger.1.html</ref> (<code> | + | {{lc}}Linux<ref>http://man7.org/linux/man-pages/man1/logger.1.html</ref> (<code>[[bsdutils]]</code> 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 [[programming Fundamentals/Introduction/Go|go]]: https://godoc.org/github.com/spkg/slog. |
== 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. | ||
− | *<code> echo "MY TEXT TO LOG" | logger -s</code> | + | logger --server 10.10.x.x "TEST" |
+ | |||
+ | * <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. | ||
+ | |||
+ | |||
+ | <code>logger -n SERVER.DOMAIN.COM -T "TEST</code> | ||
+ | logger: failed to resolve name SERVER.DOMAIN.COM port syslog-conn: Servname not supported for ai_socktype | ||
+ | |||
+ | <code>logger -n SERVER.DOMAIN.COM -T -P 514 "TEST</code> | ||
== Activities == | == Activities == | ||
Line 16: | Line 24: | ||
* <code>[[systemd-cat]]</code> | * <code>[[systemd-cat]]</code> | ||
* rfc3164 | * rfc3164 | ||
+ | * <code>[[rsyslog.conf]]</code> | ||
+ | * [[Python logging]]: [[logger (Python)]] | ||
== See also == | == See also == | ||
− | * <code>log show</code> in MacOS | + | * <code>[[log show]]</code> in MacOS |
− | * <code>[[ | + | * <code>[[journalctl]]</code> |
− | + | * {{logger}} | |
+ | * {{stdin}} | ||
+ | * {{echo}} | ||
* {{logging}} | * {{logging}} | ||
Latest revision as of 10:49, 2 October 2024
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[edit]
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[edit]
Related terms[edit]
See also[edit]
log show
in MacOSjournalctl
- logger
- Standard streams:
/dev/stdin
,/dev/stdout
,/dev/stderr
,/dev/null
, File descriptor,set -x, 2>&1, stdbuf
echo
,print, printf
,tput
,logger
,write-output, echo -e, /dev/stdout, banner
- Linux logging, Cisco IOS logging
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: