ARTICLE DETAIL

资讯详情

深耕郑州网站建设与运营推广的一线实战洞察。

【2017-09-16】linux logger命令最简单笔记

【2017-09-16】linux logger命令最简单笔记 [历史归档]本文原发布于 cstriker1407.info 个人博客内容为历史存档仅供参考。发布时间2017-09-16 标题linux logger命令最简单笔记分类linux 标签loggerlinux logger命令最简单笔记logger 是一个shell 命令接口可以通过该接口使用Syslog的系统日志模块还可以从命令行直接向系统日志文件写入一行信息。这里简单起见只笔记下如何最简单的使用logger。首先看下命令参数$ logger-hUsage: logger[message]Enter messages into the system log. 选项-ilog the logger commands PID --id[id]log the givenid, or otherwise the PID -f,--filefilelog the contents of thisfile-e, --skip-emptydonot log empty lines when processing files --no-actdoeverything except thewritethe log -p,--prioritypriomark given message with this priority --octet-count use rfc6587 octet counting --prio-prefixlookfora prefix on every linereadfrom stdin -s,--stderroutput message to standard error as well -S,--sizesizemaximum sizefora single message -t,--tagtagmark every line with this tag -n,--servernamewriteto this remote syslog server -P,--portportuse this portforUDP or TCP connection -T,--tcpuse TCP only -d,--udpuse UDP only--rfc3164use the obsolete BSD syslog protocol --rfc5424[snip]use the syslog protocol(the defaultforremote);snipcan be notime, or notq, and/or nohost --sd-ididrfc5424 structured data ID --sd-paramdatarfc5424 structured datanamevalue--msgidmsgidsetrfc5424 messageidfield -u,--socketsocketwriteto this Unix socket --socket-errors[on|off|auto]print connection errors when using Unix sockets --journald[file]writejournald entry -h,--helpdisplay thishelpandexit-V,--versionoutput version information andexitFormoredetails see logger(1).最简单使用$loggerHelloWorld $tail/var/log/syslog................Oct1619:37:01 T450-ubuntu user: HelloWorld 进程如何使用 ./test.bin|logger
返回列表