{"id":265396,"date":"2023-02-24T22:05:55","date_gmt":"2023-02-24T14:05:55","guid":{"rendered":"https:\/\/lrxjmw.cn\/lxtnhhxtyxcw.html"},"modified":"2023-02-24T22:05:55","modified_gmt":"2023-02-24T14:05:55","slug":"lxtnhhxtyxcw","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lxtnhhxtyxcw.html","title":{"rendered":"Linux\u7cfb\u7edf\u5185\u6838\u548c\u7cfb\u7edf\u8fd0\u884c\u9519\u8bef\u65f6\u5feb\u901f\u5b9a\u4f4d\u9519\u8bef\u4f4d\u7f6e\u7684\u9014\u5f84"},"content":{"rendered":"

\u65e5\u5fd7\u7cfb\u7edf<\/a>\u5c06\u6211\u4eec\u7cfb\u7edf\u8fd0\u884c\u7684\u6bcf\u4e00\u4e2a\u72b6\u51b5\u4fe1\u606f\u90fd\u4f7f\u7528\u6587\u5b57\u8bb0\u5f55\u51fa\u6765\uff0c\u8fd9\u79cd\u4fe1\u606f\u6709\u52a9\u6211\u4eec\u89c2\u5bdf\u7cfb\u7edf\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u6b63\u5e38\u72b6\u6001\u548c\u7cfb\u7edf\u8fd0\u884c\u9519\u8bef\u65f6\u5feb\u901f\u5b9a\u4f4d\u9519\u8bef\u4f4d\u7f6e\u7684\u9014\u5f84\u7b49;\u4e0b\u8fb9\u5b66\u4e60\u5566\u5c0f\u7f16\u4e3b\u8981\u6982\u8ff0\u4e00\u4e0bLinux<\/a>\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u529f\u80fd\u3002<\/p>\n

Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u529f\u80fd\u89e3\u8bfb<\/p>\n

\u5927\u90e8\u4efdLinux\u53d1\u884c\u7248\u9ed8\u8ba4\u7684\u65e5\u5fd7\u5b88\u62a4\u8fdb\u7a0b\u4e3asyslog\uff0c\u5750\u843d\/etc\/syslog\u6216\/etc\/syslogd\uff0c\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u4e3a\/etc\/syslog.conf\uff0c\u4efb\u4f55\u5e0c\u671b\u751f\u6210\u65e5\u5fd7\u7684\u7a0b\u5e8f\u90fd\u53ef\u4ee5\u5411syslog\u53d1\u9001\u4fe1\u606f\u3002<\/p>\n

Linux\u7cfb\u7edf\u5185\u6838\u548c\u8bb8\u591a\u7a0b\u5e8f\u4f1a\u5f62\u6210\u5404\u7c7b\u9519\u8bef\u4fe1\u606f\u3001\u8b66\u544a\u4fe1\u606f\u548c\u5176\u4ed6\u7684\u63d0\u793a\u4fe1\u606f\uff0c\u8fd9\u79cd\u4fe1\u606f\u5bf9\u7ba1\u7406\u5458\u4e86\u89e3\u7cfb\u7edf\u7684\u8fd0\u884c\u72b6\u6001\u662f\u5341\u5206\u6709\u7528\u7684linux\u8fd0\u7ef4\u535a\u5ba2\uff0c\u6240\u4ee5\u5e94\u5f53\u628a\u5b83\u4eec\u8bb2\u5230\u65e5\u5fd7\u6587\u4ef6\u4e2d\u53bb\u3002\u5b8c\u6210\u8fd9\u4e2a\u8fc7\u7a0b\u7684\u7a0b\u5e8f\u5c31\u662fsyslog\u3002syslog\u53ef\u4ee5\u6309\u7167\u65e5\u5fd7\u7684\u7c7b\u522b\u548c\u4f18\u5148\u7ea7\u5c06\u65e5\u5fd7\u4fdd\u5b58\u5230\u4e0d\u540c\u7684\u6587\u4ef6\u4e2d\u3002\u8bf8\u5982\uff0c\u4e3a\u4e86\u4fbf\u6377\u67e5\u9605\uff0c\u53ef\u4ee5\u628a\u5185\u6838\u4fe1\u606f\u4e0e\u5176\u4ed6\u4fe1\u606f\u5206\u5f00\uff0c\u5355\u72ec\u4fdd\u5b58\u5230\u4e00\u4e2a\u72ec\u7acb\u7684\u65e5\u5fd7\u6587\u4ef6\u4e2d\u3002\u9ed8\u8ba4\u914d\u7f6e\u4e0b\uff0c\u65e5\u5fd7\u6587\u4ef6\u4e00\u822c\u90fd\u4fdd\u5b58\u5728\u201c\/var\/log\u201d\u76ee\u5f55\u4e0b\u3002<\/p>\n

\u65e5\u5fd7\u7c7b\u578b<\/p>\n

\u4e0b\u8fb9\u662f\u5e38\u89c1\u7684\u65e5\u5fd7\u7c7b\u578b\uff0c\u4f46\u5e76\u4e0d\u662f\u6240\u6709\u7684Linux\u53d1\u884c\u7248\u90fd\u5305\u542b\u90a3\u4e9b\u7c7b\u578b\uff1a<\/p>\n

\u65e5\u5fd7\u4f18\u5148\u7ea7<\/p>\n

\u5e38\u89c1\u7684\u65e5\u5fd7\u4f18\u5148\u7ea7\u8bf7\u89c1\u4e0b\u6807\uff1a<\/p>\n

\u4f18\u5148\u7ea7\u8bf4\u660e<\/p>\n

emerg<\/p>\n

\u7d27\u6025\u60c5\u51b5\uff0c\u7cfb\u7edf\u4e0d\u53ef\u7528\uff08\u6bd4\u5982\u7cfb\u7edf\u5d29\u6e83\uff09\uff0c\u901a\u5e38\u4f1a\u901a\u77e5\u6240\u6709\u7528\u6237\u3002<\/p>\n

alert<\/p>\n

\u987b\u8981\u7acb\u523b\u4fee\u8865\uff0c\u6bd4\u5982\u7cfb\u7edf\u6570\u636e\u5e93\u53d7\u635f\u3002<\/p>\n

crit<\/p>\n

\u5371\u9669\u60c5\u51b5\uff0c\u6bd4\u5982\u786c\u789f\u9519\u8bef\uff0c\u53ef\u80fd\u4f1a\u59a8\u788d\u7a0b\u5e8f\u7684\u90e8\u4efd\u529f\u80fd\u3002<\/p>\n

err<\/p>\n

\u901a\u5e38\u9519\u8bef\u6d88\u606f\u3002<\/p>\n

warning<\/p>\n

\u8b66\u544a\u3002<\/p>\n

linux \u65e5\u5fd7\u6587\u4ef6\u7cfb\u7edf_linux \u7cfb\u7edf \u5173\u673a \u65e5\u5fd7_linux\u7cfb\u7edf\u67e5\u770b\u65e5\u5fd7<\/p>\n

notice<\/p>\n

\u4e0d\u662f\u9519\u8bef\uff0c\u5e76\u4e14\u53ef\u80fd\u987b\u8981\u5904\u7406\u3002<\/p>\n

info<\/p>\n

\u901a\u7528\u6027\u6d88\u606f\uff0c\u901a\u5e38\u62ff\u6765\u63d0\u4f9b\u6709\u7528\u4fe1\u606f\u3002<\/p>\n

debug<\/p>\n

\u8c03\u8bd5\u7a0b\u5e8f\u5f62\u6210\u7684\u4fe1\u606f\u3002<\/p>\n

none<\/p>\n

\u6ca1\u6709\u4f18\u5148\u7ea7\uff0c\u4e0d\u8bb0\u5f55\u4efb\u4f55\u65e5\u5fd7\u6d88\u606f\u3002<\/p>\n

\u5e38\u89c1\u65e5\u5fd7\u6587\u4ef6<\/p>\n

\u6240\u6709\u7684\u7cfb\u7edf\u5e94\u7528\u5c31\u4f1a\u5728\/var\/log\u76ee\u5f55\u4e0b\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\uff0c\u6216\u521b\u5efa\u5b50\u76ee\u5f55\u518d\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u3002\u8bf8\u5982\uff1a<\/p>\n

\/etc\/syslog.conf\u6587\u4ef6<\/p>\n

\/etc\/syslog.conf\u662fsyslog\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4f1a\u4f9d\u7167\u65e5\u5fd7\u7c7b\u578b\u548c\u4f18\u5148\u7ea7\u6765\u51b3\u5b9a\u5c06\u65e5\u5fd7\u4fdd\u5b58\u5230\u4f55\u5904\u3002\u5178\u578b\u7684syslog.conf\u6587\u4ef6\u683c\u5f0f\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n

*.err;kern.debug;auth.notice\/dev\/console<\/p>\n

daemon,auth.notice\/var\/log\/messages<\/p>\n

\/var\/log\/lpr.log<\/p>\n

mail.*\/var\/log\/mail.log<\/p>\n

ftp.*\/var\/log\/ftp.log<\/p>\n

auth.*@<\/p>\n

auth.*root,amrood<\/p>\n

netinfo.err\/var\/log\/netinfo.log<\/p>\n

install.*\/var\/log\/install.log<\/p>\n

*.emerg*<\/p>\n

*.alert|program_name<\/p>\n

mark.*\/dev\/console<\/p>\n

\u7b2c\u4e00\u5217\u4e3a\u65e5\u5fd7\u7c7b\u578b\u548c\u65e5\u5fd7\u4f18\u5148\u7ea7\u7684\u7ec4\u5408\uff0c\u6bcf\u4f4d\u7c7b\u578b\u548c\u4f18\u5148\u7ea7\u7684\u7ec4\u79f0\u4f5c\u4e3a\u4e00\u4e2a\u9009\u62e9\u5668;\u524d\u9762\u4e00\u5217\u4e3a\u4fdd\u5b58\u65e5\u5fd7\u7684\u6587\u4ef6\u3001\u670d\u52a1\u5668\uff0c\u6216\u8f93\u51fa\u65e5\u5fd7\u7684\u7ec8\u7aef\u3002syslog\u8fdb\u7a0b\u4f9d\u636e\u9009\u62e9\u5668\u51b3\u5b9a\u600e\u6837\u64cd\u4f5c\u65e5\u5fd7\u3002<\/p>\n

\u5bf9\u914d\u7f6e\u6587\u4ef6\u7684\u51e0\u70b9\u8bf4\u660e\uff1a<\/p>\n

\u65e5\u5fd7\u7c7b\u578b\u548c\u4f18\u5148\u7ea7\u7531\u70b9\u53f7(.)\u5206\u5f00\uff0c\u6bd4\u5982kern.debug\u8868\u793a\u7531\u5185\u6838\u5f62\u6210\u7684\u8c03\u8bd5\u4fe1\u606f\u3002<\/p>\n

kern.debug\u7684\u4f18\u5148\u7ea7\u5c0f\u4e8edebug\u3002<\/p>\n

\u661f\u53f7(*)\u8868\u793a\u6240\u6709\uff0c\u6bd4\u5982*.debug\u8868\u793a\u6240\u6709\u7c7b\u578b\u7684\u8c03\u8bd5\u4fe1\u606f\uff0ckern.*\u8868\u793a\u7531\u5185\u6838\u5f62\u6210\u7684\u6240\u6709\u6d88\u606f\u3002<\/p>\n

\u53ef\u4ee5\u4f7f\u7528\u5192\u53f7(,)\u5206\u9694\u591a\u4e2a\u65e5\u5fd7\u7c7b\u578b\uff0c\u4f7f\u7528\u5206\u53f7(;)\u5206\u9694\u591a\u4e2a\u9009\u62e9\u5668\u3002<\/p>\n

\u5bf9\u65e5\u5fd7\u7684\u64cd\u4f5c\u5305\u62ec\uff1a<\/p>\n

\u5c06\u65e5\u5fd7\u8f93\u51fa\u5230\u6587\u4ef6\uff0c\u6bd4\u5982\/var\/log\/maillog\u6216\/dev\/console\u3002<\/p>\n

\u5c06\u6d88\u606f\u53d1\u9001\u7ed9\u7528\u6237\uff0c\u591a\u4e2a\u7528\u6237\u7528\u5192\u53f7(,)\u5206\u9694linux \u65e5\u5fd7\u6587\u4ef6\u7cfb\u7edf<\/strong>\uff0c\u6bd4\u5982root,amrood\u3002<\/p>\n

\u901a\u8fc7\u7ba1\u7ebf\u5c06\u6d88\u606f\u53d1\u9001\u7ed9\u7528\u6237\u7a0b\u5e8f\uff0c\u6ce8\u610f\u7a0b\u5e8f\u8981\u7f6e\u4e8e\u7ba1\u7ebf\u7b26(|)\u65c1\u8fb9\u3002<\/p>\n

\u5c06\u6d88\u606f\u53d1\u9001\u7ed9\u5176\u4ed6\u4e3b\u673a\u4e0a\u7684syslog\u8fdb\u7a0b\uff0c\u8fd9\u65f6\/etc\/syslog.conf\u6587\u4ef6\u524d\u9762\u4e00\u5217\u4e3a\u4ee5@\u5f00\u5934\u7684\u4e3b\u673a\u540dlinux \u65e5\u5fd7\u6587\u4ef6\u7cfb\u7edf<\/strong>\uff0c\u6bd4\u5982@\u3002<\/p>\n

logger\u547d\u4ee4<\/a><\/p>\n

logger\u662fShell\u547d\u4ee4\uff0c\u53ef\u4ee5\u901a\u8fc7\u8be5\u547d\u4ee4\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

logger\u547d\u4ee4\u7684\u53e5\u578b\u4e3a\uff1a<\/p>\n

logger[-i][-ffilename][-ppriority][-ttag][message...]<\/p>\n

\u6bcf\u4f4d\u9009\u9879\u7684\u542b\u610f\u5982\u4e0b\uff1a<\/p>\n

\u6bd4\u5982\uff0c\u5c06ping\u547d\u4ee4\u7684\u7ed3\u679c\u5199\u5165\u65e5\u5fd7\uff1a<\/p>\n

$ping192.168.0.1|logger-itlogger_test-plocal3.notice&<\/p>\n

$tail-f\/var\/log\/userlog<\/p>\n

Oct612:48:43keveinlogger_test[22484]:PING192.168.0.1(192.168.0.1)56(84)bytesofdata.<\/p>\n

Oct612:48:43keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=1ttl=253time=49.7ms<\/p>\n

Oct612:48:44keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=2ttl=253time=68.4ms<\/p>\n

Oct612:48:45keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=3ttl=253time=315ms<\/p>\n

Oct612:48:46keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=4ttl=253time=279ms<\/p>\n

Oct612:48:47keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=5ttl=253time=347ms<\/p>\n

Oct612:48:49keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=6ttl=253time=701ms<\/p>\n

Oct612:48:50keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=7ttl=253time=591ms<\/p>\n

Oct612:48:51keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=8ttl=253time=592ms<\/p>\n

Oct612:48:52keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=9ttl=253time=611ms<\/p>\n

Oct612:48:53keveinlogger_test[22484]:64bytesfrom192.168.0.1:icmp_seq=10ttl=253time=931ms<\/p>\n

ping\u547d\u4ee4\u7684\u7ed3\u679c\u6210\u529f\u8f93\u51fa\u5230\/var\/log\/userlog\u6587\u4ef6\u3002<\/p>\n

\u547d\u4ee4logger-itlogger_test-plocal3.notice\u5404\u9009\u9879\u7684\u542b\u610f\uff1a<\/p>\n

-i\uff1a\u5728\u6bcf\u884c\u90fd\u8bb0\u5f55\u8fdb\u7a0bID;<\/p>\n

-tlogger_test\uff1a\u6bcf\u884c\u8bb0\u5f55\u90fd\u52a0\u4e0a\u201clogger_test\u201d\u8fd9\u4e2a\u6807\u7b7e;<\/p>\n

linux \u65e5\u5fd7\u6587\u4ef6\u7cfb\u7edf_linux \u7cfb\u7edf \u5173\u673a \u65e5\u5fd7_linux\u7cfb\u7edf\u67e5\u770b\u65e5\u5fd7<\/p>\n

-plocal3.notice\uff1a\u8bbe\u7f6e\u65e5\u5fd7\u7c7b\u578b\u548c\u4f18\u5148\u7ea7\u3002<\/p>\n

\u65e5\u5fd7\u8f6e\u8be2<\/p>\n

\u65e5\u5fd7\u8f6e\u8be2\u4e5f\u53eb\u65e5\u5fd7\u56de\u5377\u6216\u65e5\u5fd7\u8f6e\u8f6c\u3002Linux\u4e2d\u7684\u65e5\u5fd7\u4e00\u822c\u4e0b\u964d\u5f88\u5feb\uff0c\u4f1a\u5360\u7528\u5927\u91cf\u786c\u789f\u7a7a\u95f4\uff0c\u987b\u8981\u5728\u65e5\u5fd7\u6587\u4ef6\u8fbe\u5230\u6307\u5b9a\u5927\u5c0f\u65f6\u5206\u5f00\u50a8\u5b58\u3002<\/p>\n

syslog\u53ea\u8d1f\u8d23\u63a5\u6536\u65e5\u5fd7\u5e76\u4fdd\u5b58\u5230\u76f8\u5e94\u7684\u6587\u4ef6\uff0c\u4f46\u4e0d\u4f1a\u5bf9\u65e5\u5fd7\u6587\u4ef6\u8fdb\u884c\u7ba1\u7406\uff0c\u56e0\u800c\u5e38\u5e38\u4f1a\u5bfc\u81f4\u65e5\u5fd7\u6587\u4ef6\u8fc7\u5927\uff0c\u5c24\u5176\u662fWEB\u670d\u52a1\u5668\uff0c\u8f7b\u6613\u80fd\u591f\u8d85\u8fc71G\uff0c\u7ed9\u68c0\u7d22\u5e26\u6765\u56f0\u96be\u3002<\/p>\n

\u5927\u591a\u6570Linux\u53d1\u884c\u7248\u4f7f\u7528logrotate\u6216newsyslog\u5bf9\u65e5\u5fd7\u8fdb\u884c\u7ba1\u7406\u3002logrotate\u7a0b\u5e8f\u4e0d\u4f46\u53ef\u4ee5\u538b\u7f29\u65e5\u5fd7\u6587\u4ef6\uff0c\u964d\u4f4e\u50a8\u5b58\u7a7a\u95f4\uff0c\u8fd8\u53ef\u4ee5\u5c06\u65e5\u5fd7\u53d1\u9001\u5230\u6307\u5b9aE-mail\uff0c\u4fbf\u6377\u7ba1\u7406\u5458\u53ca\u65f6\u67e5\u770b\u65e5\u5fd7\u3002<\/p>\n

\u6bd4\u5982\uff0c\u89c4\u5b9a\u7535\u90ae\u65e5\u5fd7\/var\/log\/maillog\u8d85\u8fc71G\u65f6\u8f6e\u8be2\uff0c\u6bcf\u5468\u4e00\u6b21\uff0c\u8fd9\u4e48\u6bcf\u9694\u4e00\u5468logrotate\u8fdb\u7a0b\u90fd\u4f1a\u68c0\u6d4b\/var\/log\/maillog\u6587\u4ef6\u7684\u5927\u5c0f\uff1a<\/p>\n

\u5047\u5982\u6ca1\u6709\u8d85\u8fc71G\uff0c\u4e0d\u8fdb\u884c\u4efb\u4f55\u64cd\u4f5c\u3002<\/p>\n

\u5047\u5982\u57281G~2G\u4e4b\u95f4linux \u865a\u62df\u4e3b\u673a\uff0c\u90fd\u4f1a\u521b\u5efa\u65b0\u6587\u4ef6\/var\/log\/maillog.1\uff0c\u5e76\u5c06\u591a\u51fa\u76841G\u65e5\u5fd7\u8f6c\u79fb\u5230\u8be5\u6587\u4ef6\uff0c\u4ee5\u7ed9\/var\/log\/maillog\u6587\u4ef6\u51cf\u80a5\u3002<\/p>\n

\u5047\u5982\u57282G~3G\u4e4b\u95f4\uff0c\u4f1a\u7ee7\u7eed\u521b\u5efa\u65b0\u6587\u4ef6\/var\/log\/maillog.2\uff0c\u5e76\u5c06\/var\/log\/maillog.1\u7684\u5185\u5bb9\u8f6c\u79fb\u5230\u8be5\u6587\u4ef6\uff0c\u5c06\/var\/log\/maillog\u7684\u5185\u5bb9\u8f6c\u79fb\u5230\/var\/log\/maillog.1\uff0c\u4ee5\u4fdd\u6301\/var\/log\/maillog\u6587\u4ef6\u4e0d\u8d85\u8fc71G\u3002<\/p>\n

\u53ef\u4ee5\u770b\u89c1\uff0c\u6bcf\u6b21\u8f6c\u5b58\u5c31\u4f1a\u521b\u5efa\u4e00\u4e2a\u65b0\u6587\u4ef6(\u5047\u5982\u4e0d\u5b58\u5728)\uff0c\u547d\u540d\u683c\u5f0f\u4e3a\u65e5\u5fd7\u6587\u4ef6\u540d\u52a0\u4e00\u4e2a\u6570\u5b57(\u4ece1\u5f00\u59cb\u624b\u52a8\u4e0b\u964d)\uff0c\u4ee5\u4fdd\u6301\u5f53\u524d\u65e5\u5fd7\u6587\u4ef6\u548c\u8f6c\u5b58\u540e\u7684\u65e5\u5fd7\u6587\u4ef6\u4e0d\u8d85\u8fc7\u6307\u5b9a\u5927\u5c0f\u3002<\/p>\n

logrotate\u7684\u4e3b\u8981\u914d\u7f6e\u6587\u4ef6\u662f\/etc\/logrotate.conf\uff0c\/etc\/logrotate.d\u76ee\u5f55\u662f\u5bf9\/etc\/logrotate.conf\u7684\u8865\u5145\uff0c\u6216\u5219\u8bf4\u4e3a\u4e86\u4e0d\u4f7f\/etc\/logrotate.conf\u8fc7\u5927\u800c\u8bbe\u7f6e\u3002<\/p>\n

\u53ef\u4ee5\u901a\u8fc7cat\u547d\u4ee4\u67e5\u770b\u5b83\u7684\u5185\u5bb9\uff1a<\/p>\n

$cat\/etc\/logrotate.conf<\/p>\n

#see\"manlogrotate\"fordetails\/\/\u53ef\u4ee5\u67e5\u770b\u5e2e\u52a9\u6587\u6863<\/p>\n

#rotatelogfilesweekly<\/p>\n

weekly\/\/\u8bbe\u7f6e\u6bcf\u5468\u8f6e\u8be2\u4e00\u6b21<\/p>\n

#keep4weeksworthofbacklogs<\/p>\n

rotate4\/\/\u6700\u591a\u8f6e\u8be24\u6b21<\/p>\n

#createnew(empty)logfilesafterrotatingoldones<\/p>\n

create\/\/\u5f53\u8f6e\u8be2\u540e\u6587\u4ef6\u4e0d\u50a8\u5b58\u65f6\u521b\u5efa\u5b83<\/p>\n

#uncommentthisifyouwantyourlogfilescompressed<\/p>\n

#compress\/\/\u4ee5\u538b\u7f29\u65b9\u6cd5\u8f6e\u8be2<\/p>\n

#RPMpackagesdroplogrotationinformationintothisdirectory<\/p>\n

include\/etc\/logrotate.d\/\/\u5176\u4ed6\u65e5\u5fd7\u6587\u4ef6\u7684\u8f6e\u8be2\u5f62\u5f0f\uff0c\u5305\u542b\u5728\u8be5\u76ee\u5f55\u4e0b<\/p>\n

#nopackagesownwtmp--we'llrotatethemhere<\/p>\n

\/var\/log\/wtmp{\/\/\u8bbe\u7f6e\/var\/log\/wtmp\u65e5\u5fd7\u6587\u4ef6\u7684\u8f6e\u8be2\u53c2\u6570<\/p>\n

monthly\/\/\u6bcf\u6708\u8f6e\u8be2<\/p>\n

create0664rootutmp\/\/\u8f6e\u8be2\u540e\u6587\u4ef6\u4e0d\u5b58\u5728\u65f6\u521b\u5efa\u5b83\uff0c\u6587\u4ef6\u6240\u6709\u8005\u4e3aroot\uff0c\u6240\u5c5e\u7ec4\u4e3autmp\uff0c\u5bf9\u5e94\u7684\u6743\u9650\u4e3a0664<\/p>\n

rotate1\/\/\u6700\u591a\u8f6e\u8be2\u4e00\u6b21<\/p>\n

}<\/p>\n

\u6ce8\u610f\uff1ainclude\u5bb9\u8bb8\u7ba1\u7406\u5458\u628a\u591a\u4e2a\u5206\u6563\u7684\u6587\u4ef6\u96c6\u4e2d\u5230\u4e00\u4e2a\uff0c\u7c7b\u4f3c\u4e8eC\u8bed\u8a00\u7684#include\uff0c\u5c06\u5176\u4ed6\u6587\u4ef6\u7684\u5185\u5bb9\u5305\u542b\u8fdb\u5f53\u524d\u6587\u4ef6\u3002<\/p>\n

include\u7279\u522b\u6709\u7528\uff0c\u4e00\u4e9b\u7a0b\u5e8f\u4f1a\u628a\u8f6e\u8be2\u65e5\u5fd7\u7684\u914d\u7f6e\u6587\u4ef6\u7f6e\u4e8e\/etc\/logrotate.d\u76ee\u5f55\uff0c\u8fd9\u79cd\u914d\u7f6e\u6587\u4ef6\u4f1a\u8986\u76d6\u6216\u964d\u4f4e\/etc\/logrotate.conf\u7684\u914d\u7f6e\u9879\uff0c\u5047\u5982\u6ca1\u6709\u6307\u5b9a\u76f8\u5173\u914d\u7f6e\uff0c\u8fd9\u4e48\u91c7\u7528\/etc\/logrotate.conf\u7684\u9ed8\u8ba4\u914d\u7f6e\u3002<\/p>\n

\u6240\u4ee5\uff0c\u5efa\u8bae\u5c06\/etc\/logrotate.conf\u4f5c\u4e3a\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\uff0c\u7b2c\u4e09\u65b9\u7a0b\u5e8f\u5728\/etc\/logrotate.d\u76ee\u5f55\u4e0b\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n

logrotate\u4e5f\u53ef\u4ee5\u4f5c\u4e3a\u547d\u4ee4\u76f4\u63a5\u8fd0\u884c\u6765\u66f4\u6539\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n

\u770b\u8fc7\u201cLinux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u529f\u80fd\u89e3\u8bfb\u201d\u7684\u4eba\u8fd8\u770b\u4e86\uff1a<\/p>\n

1.Linux\u7cfb\u7edf\u67e5\u770b\u5f53\u524d\u65f6\u95f4\u7684\u547d\u4ee4<\/p>\n

2.Linux\u4e2d\u600e\u6837\u4f7f\u7528find\u547d\u4ee4\u8fdb\u884c\u65e5\u5fd7\u5b9a\u671f\u8f6c\u79fb<\/p>\n

3.linux\u5982\u4f55\u67e5\u770b\u663e\u5b58<\/p>\n

4.RedHat\u600e\u4e48\u5b89\u88c5log4cxx\u65e5\u5fd7\u5e93<\/p>\n

5.Tomcat\u5982\u4f55\u5173\u6389\u65e5\u5fd7\u8f93\u51fa<\/p>\n","protected":false},"excerpt":{"rendered":"

\u65e5\u5fd7\u7cfb\u7edf\u5c06\u6211\u4eec\u7cfb\u7edf\u8fd0\u884c\u7684\u6bcf\u4e00\u4e2a\u72b6\u51b5\u4fe1\u606f\u90fd\u4f7f\u7528\u6587\u5b57\u8bb0\u5f55\u4e0b\u6765\uff0c\u8fd9\u4e9b\u4fe1\u606f\u6709\u52a9\u6211\u4eec\u89c2\u5bdf\u7cfb\u7edf\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u6b63\u5e38\u72b6\u6001\u548c\u7cfb\u7edf\u8fd0\u884c\u9519\u8bef\u65f6\u5feb\u901f\u5b9a\u4f4d\u9519\u8bef\u4f4d\u7f6e\u7684\u9014\u5f84\u7b49;\u4e0b\u9762\u5b66\u4e60\u5566\u5c0f\u7f16\u4e3b\u8981\u6982\u8ff0\u4e00\u4e0bLinux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u529f\u80fd\u3002Linux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u529f\u80fd\u8be6\u89e3\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\/\/\u5176\u4ed6\u65e5\u5fd7\u6587\u4ef6\u7684\u8f6c\u50a8\u65b9\u5f0f\uff0c\u5305\u542b\u5728\u8be5\u76ee\u5f55\u4e0bLinux\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u65e5\u5fd7\u529f\u80fd\u8be6\u89e3\u201d\u7684\u4eba\u8fd8\u770b\u4e86\uff1a<\/p>\n","protected":false},"author":1,"featured_media":265398,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-265396","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/265396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=265396"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/265396\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/265398"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=265396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=265396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=265396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}