{"id":41714,"date":"2024-10-02T05:36:36","date_gmt":"2024-10-01T21:36:36","guid":{"rendered":"https:\/\/server.hk\/cnblog\/41714\/"},"modified":"2024-10-02T05:36:36","modified_gmt":"2024-10-01T21:36:36","slug":"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8mod_logio%e8%a8%ad%e5%ae%9aapache","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/41714\/","title":{"rendered":"Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528mod_logio\u8a2d\u5b9aApache"},"content":{"rendered":"<h1 id=\"apache%e6%96%b0%e6%89%8b%e6%95%99%e7%a8%8b%ef%bc%9a%e4%bd%bf%e7%94%a8mod_logio%e8%a8%ad%e5%ae%9aapache-wiVIvxZXds\">Apache\u65b0\u624b\u6559\u7a0b\uff1a\u4f7f\u7528mod_logio\u8a2d\u5b9aApache<\/h1>\n<p>Apache HTTP\u4f3a\u670d\u5668\u662f\u7576\u4eca\u6700\u6d41\u884c\u7684\u7db2\u9801\u4f3a\u670d\u5668\u4e4b\u4e00\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5f0f\u4e2d\u3002\u5c0d\u65bc\u65b0\u624b\u4f86\u8aaa\uff0c\u4e86\u89e3\u5982\u4f55\u914d\u7f6eApache\u7684\u65e5\u8a8c\u8a18\u9304\u529f\u80fd\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u9019\u4e0d\u50c5\u6709\u52a9\u65bc\u76e3\u63a7\u4f3a\u670d\u5668\u7684\u6027\u80fd\uff0c\u9084\u80fd\u5e6b\u52a9\u6392\u67e5\u554f\u984c\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528mod_logio\u6a21\u7d44\u4f86\u8a2d\u5b9aApache\u7684\u65e5\u8a8c\u8a18\u9304\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afmod_logio%ef%bc%9f-wiVIvxZXds\">\u4ec0\u9ebc\u662fmod_logio\uff1f<\/h2>\n<p>mod_logio\u662fApache\u7684\u4e00\u500b\u6a21\u7d44\uff0c\u4e3b\u8981\u7528\u65bc\u64f4\u5c55\u65e5\u8a8c\u8a18\u9304\u529f\u80fd\u3002\u5b83\u53ef\u4ee5\u8a18\u9304\u6bcf\u500b\u8acb\u6c42\u7684\u50b3\u8f38\u5b57\u7bc0\u6578\uff0c\u9019\u5c0d\u65bc\u5206\u6790\u6d41\u91cf\u548c\u6027\u80fd\u975e\u5e38\u6709\u5e6b\u52a9\u3002\u901a\u904e\u4f7f\u7528mod_logio\uff0c\u7ba1\u7406\u54e1\u53ef\u4ee5\u7372\u5f97\u66f4\u8a73\u7d30\u7684\u65e5\u8a8c\u4fe1\u606f\uff0c\u5f9e\u800c\u66f4\u597d\u5730\u7406\u89e3\u4f3a\u670d\u5668\u7684\u904b\u884c\u72c0\u6cc1\u3002<\/p>\n<h2 id=\"%e5%a6%82%e4%bd%95%e5%95%9f%e7%94%a8mod_logio-wiVIvxZXds\">\u5982\u4f55\u555f\u7528mod_logio<\/h2>\n<p>\u5728\u4f7f\u7528mod_logio\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u78ba\u4fdd\u5b83\u5df2\u7d93\u5728Apache\u4e2d\u555f\u7528\u3002\u4ee5\u4e0b\u662f\u555f\u7528mod_logio\u7684\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li>\u6253\u958bApache\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u65bc\/etc\/httpd\/conf\/httpd.conf\u6216\/etc\/apache2\/apache2.conf\u3002<\/li>\n<li>\u67e5\u627e\u4ee5\u4e0b\u884c\uff0c\u78ba\u4fdd\u5b83\u6c92\u6709\u88ab\u8a3b\u89e3\u6389\uff08\u5373\u524d\u9762\u6c92\u6709#\u7b26\u865f\uff09\uff1a<\/li>\n<pre><code>LoadModule logio_module modules\/mod_logio.so<\/code><\/pre>\n<li>\u5982\u679c\u9019\u884c\u88ab\u8a3b\u89e3\u6389\uff0c\u8acb\u53bb\u6389#\u7b26\u865f\uff0c\u7136\u5f8c\u4fdd\u5b58\u6587\u4ef6\u3002<\/li>\n<li>\u91cd\u555fApache\u4f3a\u670d\u5668\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/li>\n<pre><code>sudo systemctl restart apache2<\/code><\/pre>\n<\/ol>\n<h2 id=\"%e9%85%8d%e7%bd%ae%e6%97%a5%e8%aa%8c%e6%a0%bc%e5%bc%8f-wiVIvxZXds\">\u914d\u7f6e\u65e5\u8a8c\u683c\u5f0f<\/h2>\n<p>\u555f\u7528mod_logio\u5f8c\uff0c\u63a5\u4e0b\u4f86\u9700\u8981\u914d\u7f6e\u65e5\u8a8c\u683c\u5f0f\u3002\u53ef\u4ee5\u5728Apache\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u6216\u4fee\u6539LogFormat\u6307\u4ee4\uff0c\u4ee5\u5305\u542b\u50b3\u8f38\u5b57\u7bc0\u6578\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u793a\u4f8b\uff1a<\/p>\n<pre><code>LogFormat \"%h %l %u %t \"%r\" %&gt;s %b %I\" common<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c%I\u8868\u793a\u8acb\u6c42\u7684\u50b3\u8f38\u5b57\u7bc0\u6578\u3002\u9019\u6a23\u914d\u7f6e\u5f8c\uff0cApache\u5c07\u5728\u65e5\u8a8c\u4e2d\u8a18\u9304\u6bcf\u500b\u8acb\u6c42\u7684\u50b3\u8f38\u5b57\u7bc0\u6578\u3002<\/p>\n<h2 id=\"%e6%9f%a5%e7%9c%8b%e6%97%a5%e8%aa%8c-wiVIvxZXds\">\u67e5\u770b\u65e5\u8a8c<\/h2>\n<p>\u65e5\u8a8c\u6587\u4ef6\u901a\u5e38\u4f4d\u65bc\/var\/log\/apache2\/access.log\u6216\/var\/log\/httpd\/access_log\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u65e5\u8a8c\uff1a<\/p>\n<pre><code>tail -f \/var\/log\/apache2\/access.log<\/code><\/pre>\n<p>\u9019\u6a23\u53ef\u4ee5\u5be6\u6642\u67e5\u770b\u65e5\u8a8c\u7684\u66f4\u65b0\uff0c\u5e6b\u52a9\u7ba1\u7406\u54e1\u53ca\u6642\u767c\u73fe\u554f\u984c\u3002<\/p>\n<h2 id=\"%e4%bd%bf%e7%94%a8mod_logio%e7%9a%84%e5%a5%bd%e8%99%95-wiVIvxZXds\">\u4f7f\u7528mod_logio\u7684\u597d\u8655<\/h2>\n<ul>\n<li><strong>\u6d41\u91cf\u5206\u6790\uff1a<\/strong>\u901a\u904e\u8a18\u9304\u6bcf\u500b\u8acb\u6c42\u7684\u50b3\u8f38\u5b57\u7bc0\u6578\uff0c\u7ba1\u7406\u54e1\u53ef\u4ee5\u66f4\u597d\u5730\u5206\u6790\u7db2\u7ad9\u7684\u6d41\u91cf\u60c5\u6cc1\u3002<\/li>\n<li><strong>\u6027\u80fd\u76e3\u63a7\uff1a<\/strong>\u53ef\u4ee5\u6839\u64da\u65e5\u8a8c\u6578\u64da\u8a55\u4f30\u4f3a\u670d\u5668\u7684\u6027\u80fd\uff0c\u53ca\u6642\u8abf\u6574\u914d\u7f6e\u4ee5\u63d0\u9ad8\u6548\u7387\u3002<\/li>\n<li><strong>\u554f\u984c\u6392\u67e5\uff1a<\/strong>\u7576\u7db2\u7ad9\u51fa\u73fe\u554f\u984c\u6642\uff0c\u8a73\u7d30\u7684\u65e5\u8a8c\u4fe1\u606f\u53ef\u4ee5\u5e6b\u52a9\u5feb\u901f\u5b9a\u4f4d\u554f\u984c\u6240\u5728\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-wiVIvxZXds\">\u7e3d\u7d50<\/h2>\n<p>\u4f7f\u7528mod_logio\u4f86\u8a2d\u5b9aApache\u7684\u65e5\u8a8c\u8a18\u9304\u529f\u80fd\uff0c\u53ef\u4ee5\u5e6b\u52a9\u7ba1\u7406\u54e1\u66f4\u597d\u5730\u76e3\u63a7\u4f3a\u670d\u5668\u7684\u904b\u884c\u72c0\u6cc1\u3002\u901a\u904e\u7c21\u55ae\u7684\u914d\u7f6e\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u7372\u5f97\u66f4\u8a73\u7d30\u7684\u65e5\u8a8c\u4fe1\u606f\uff0c\u5f9e\u800c\u9032\u884c\u6d41\u91cf\u5206\u6790\u548c\u6027\u80fd\u76e3\u63a7\u3002\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684<em><a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a><\/em>\u89e3\u6c7a\u65b9\u6848\uff0cServer.HK\u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4e60\u5982\u4f55\u4f7f\u7528mod_logio\u6a21\u5757\u5728Apache\u4e2d\u8bbe\u7f6e\u65e5\u5fd7\u8bb0\u5f55\uff0c\u63d0\u5347\u670d\u52a1\u5668\u6027\u80fd\u4e0e\u76d1\u63a7\u80fd\u529b\uff0c\u9002\u5408\u65b0\u624b\u5feb\u901f\u4e0a\u624b\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-41714","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=41714"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41714\/revisions"}],"predecessor-version":[{"id":41715,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/41714\/revisions\/41715"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=41714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=41714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=41714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}