linux日志514命令,linux 命令之logger

1、logger命令介绍

a shell command interface to the syslog(3) system log module

用于往系统中写入日志,他提供一个shell命令接口到syslog系统模块

2、logger参数详解-d, --udp

Use datagram (UDP) instead of the default stream connection (TCP).

使用udp链接而不是tcp链接

-i, --id

Log the process ID of the logger process with each line.

逐行记录每一次logger的进程ID

-f, --file file

Log the contents of the specified file.  This option cannot be combined with a command-line message.

记录特殊文件的内容,这个参数不能够包含了命令行的信息。

-h, --help

Display a help text and exit.

展示帮助信息

-n, --server server

Write to the specified remote syslog server using UDP instead of to the builtin syslog routines.

使用udp而不是内置惯例的syslog写的如到特定的远端的syslog服务器

-P, --port port

Use the specified UDP port.  The default port number is 514.

使用特定的UDP端口,默认的端口是514

-p, --priority priority

Enter the message into the log with the specified priority.  The priority may be specified numerically or as a facil‐ity.level pair.  For example, -p local3.info logs the message as informational in the local3 facility.  The default is user.notice.

指定输入消息的优先级,优先级可以是数字或者指定为 " facility.level" 的格式。比如:" -p local3.info " local3 这个设备的消息级别为 info。默认级别是 "user.notice"

-s, --stderr

Output the message to standard error as well as to the system log.

输出错误到系统日志

-t, --tag tag

Mark every line to be logged with the specified tag.

对每行记录最特殊的标记

-u, --socket socket

Write to the specified socket instead of to the builtin syslog routines.         写到特定的socket而不是内置惯例的syslog。

-V, --version

Display version information and exit.

显示版本信息

**messages:**写入log文件的内容消息时,可以使用-f参数。

logger 以0退出时代表成功,大于0代表失败。

3、logger的用途和日志级别

Valid facility names are: auth, authpriv (for security information of a sensitive nature), cron, daemon, ftp, kern (can't be gener‐ated from user process), lpr, mail, news, security (deprecated synonym for auth), syslog, user, uucp, and local0 to local7, inclu‐sive.

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 syslog(3).

notice         正常但是要注意

4、EXAMPLESlogger System rebooted

logger -p local0.notice -t HOSTIDM -f /dev/idmc

logger -n loghost.example.com System rebooted

5、Others

SEE ALSO

syslog(3), syslogd(8)

STANDARDS

The logger command is expected to be IEEE Std 1003.2 (“POSIX.2”) compatible.

AVAILABILITY

The logger command is part of the util-linux package and is available from           ftp://ftp.kernel.org/pub/linux/utils/util-linux/.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值