{"id":6362,"date":"2020-01-19T19:52:48","date_gmt":"2020-01-19T11:52:48","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=6362"},"modified":"2020-01-21T16:32:51","modified_gmt":"2020-01-21T08:32:51","slug":"logger","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/logger","title":{"rendered":"logger\u547d\u4ee4 – \u7cfb\u7edf\u65e5\u5fd7\u8bb0\u5f55"},"content":{"rendered":"\n
logger\u662f\u4e00\u4e2ashell\u547d\u4ee4\u63a5\u53e3\uff0c\u53ef\u4ee5\u901a\u8fc7\u8be5\u63a5\u53e3\u4f7f\u7528Syslog\u7684\u7cfb\u7edf\u65e5\u5fd7\u6a21\u5757\uff0c\u8fd8\u53ef\u4ee5\u4ece\u547d\u4ee4\u884c\u76f4\u63a5\u5411\u7cfb\u7edf\u65e5\u5fd7\u6587\u4ef6\u5199\u5165\u4e00\u884c\u4fe1\u606f\u3002 <\/p>\n\n\n\n
logger\u8bb0\u5f55\u5668\u901a\u8fc7\u5728\u7cfb\u7edf\u65e5\u5fd7\u4e2d\u521b\u5efa\u6761\u76ee\uff0c\u4e3asyslog\u7cfb\u7edf\u65e5\u5fd7\u6a21\u5757\u63d0\u4f9b\u4e86\u4e00\u4e2ashell\u547d\u4ee4\u63a5\u53e3\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>logger [\u53c2\u6570]<\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u5f80\u7cfb\u7edf\u65e5\u5fd7\u4f8b\u7a0b\u4e2d\u5199\u5165\uff0c\u5728\/var\/log\/syslog\u4e2d\u67e5\u770b\uff1a<\/p>\n\n\n\n \u8bb0\u5f55\u7279\u5b9a\u7684\u6587\u4ef6\uff1a<\/p>\n\n\n\n logger\u662f\u4e00\u4e2ashell\u547d\u4ee4\u63a5\u53e3\uff0c\u53ef\u4ee5\u901a\u8fc7\u8be5\u63a5\u53e3\u4f7f\u7528Syslog\u7684\u7cfb\u7edf\u65e5\u5fd7\u6a21\u5757\uff0c\u8fd8\u53ef\u4ee5\u4ece\u547d\u4ee4\u884c\u76f4\u63a5\u5411\u7cfb\u7edf\u65e5 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6362"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=6362"}],"version-history":[{"count":5,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6362\/revisions"}],"predecessor-version":[{"id":6550,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6362\/revisions\/6550"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=6362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=6362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=6362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-d<\/td> \u4f7f\u7528\u6570\u636e\u62a5(UDP)\u800c\u4e0d\u662f\u4f7f\u7528\u9ed8\u8ba4\u7684\u6d41\u8fde\u63a5(TCP)<\/td><\/tr> -i<\/td> \u9010\u884c\u8bb0\u5f55\u6bcf\u4e00\u6b21logger\u7684\u8fdb\u7a0bID<\/td><\/tr> -f<\/td> \u8bb0\u5f55\u7279\u5b9a\u7684\u6587\u4ef6<\/td><\/tr> -n<\/td> \u5199\u5165\u6307\u5b9a\u7684\u8fdc\u7a0bsyslog\u670d\u52a1\u5668\uff0c\u4f7f\u7528UDP\u4ee3\u66ff\u5185\u88c5\u5f0fsyslog\u7684\u4f8b\u7a0b<\/td><\/tr> -P<\/td> \u4f7f\u7528\u6307\u5b9a\u7684UDP\u7aef\u53e3\uff0c\u9ed8\u8ba4\u7684\u7aef\u53e3\u53f7\u662f514<\/td><\/tr> -s<\/td> \u8f93\u51fa\u6807\u51c6\u9519\u8bef\u5230\u7cfb\u7edf\u65e5\u5fd7<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n [root@linuxcool ~]# logger System Rebooted<\/pre>\n\n\n\n
[root@linuxcool ~]# logger -f \/home\/a.txt<\/pre>\n","protected":false},"excerpt":{"rendered":"