{"id":153117,"date":"2019-08-15T10:21:14","date_gmt":"2019-08-15T02:21:14","guid":{"rendered":"https:\/\/gulass.cn\/?p=153117"},"modified":"2019-08-08T13:22:41","modified_gmt":"2019-08-08T05:22:41","slug":"logreduce","status":"publish","type":"post","link":"https:\/\/gulass.cn\/logreduce.html","title":{"rendered":"\u4f7f\u7528\u673a\u5668\u5b66\u4e60\u6765\u964d\u4f4e\u566a\u97f3"},"content":{"rendered":"
\u6301\u7eed\u96c6\u6210\uff08CI\uff09\u4f5c\u4e1a\u4f1a\u751f\u6210\u5927\u91cf\u6570\u636e\u3002\u5f53\u4e00\u4e2a\u4f5c\u4e1a\u5931\u8d25\u65f6\uff0c\u5f04\u6e05\u695a\u51fa\u4e86\u4ec0\u4e48\u95ee\u9898\u53ef\u80fd\u662f\u4e00\u4e2a\u7e41\u7410\u7684\u8fc7\u7a0b\uff0c\u5b83\u6d89\u53ca\u5230\u8c03\u67e5\u65e5\u5fd7\u4ee5\u53d1\u73b0\u6839\u672c\u539f\u56e0 \u2014\u2014 \u8fd9\u901a\u5e38\u53ea\u80fd\u5728\u5168\u90e8\u7684\u4f5c\u4e1a\u8f93\u51fa\u7684\u4e00\u5c0f\u90e8\u5206\u4e2d\u627e\u5230\u3002\u4e3a\u4e86\u66f4\u5bb9\u6613\u5730\u5c06\u6700\u76f8\u5173\u7684\u6570\u636e\u4e0e\u5176\u4f59\u6570\u636e\u5206\u5f00\uff0c\u53ef\u4ee5\u4f7f\u7528\u5148\u524d\u6210\u529f\u8fd0\u884c\u7684\u4f5c\u4e1a\u7ed3\u679c\u6765\u8bad\u7ec3 Logreduce \u673a\u5668\u5b66\u4e60\u6a21\u578b\uff0c\u4ee5\u4ece\u5931\u8d25\u7684\u8fd0\u884c\u65e5\u5fd7\u4e2d\u63d0\u53d6\u5f02\u5e38\u3002<\/p>\n
\u6b64\u65b9\u6cd5\u4e5f\u53ef\u4ee5\u5e94\u7528\u4e8e\u5176\u4ed6\u7528\u4f8b\uff0c\u4f8b\u5982\uff0c\u4ece Journald \u6216\u5176\u4ed6\u7cfb\u7edf\u7ea7\u7684\u5e38\u89c4\u65e5\u5fd7\u6587\u4ef6\u4e2d\u63d0\u53d6\u5f02\u5e38\u3002<\/p>\n
\u5178\u578b\u7684\u65e5\u5fd7\u6587\u4ef6\u5305\u542b\u8bb8\u591a\u6807\u79f0\u4e8b\u4ef6\uff08\u201c\u57fa\u7ebf\u201d\uff09\u4ee5\u53ca\u4e0e\u5f00\u53d1\u4eba\u5458\u76f8\u5173\u7684\u4e00\u4e9b\u4f8b\u5916\u4e8b\u4ef6\u3002\u57fa\u7ebf\u53ef\u80fd\u5305\u542b\u968f\u673a\u5143\u7d20\uff0c\u4f8b\u5982\u96be\u4ee5\u68c0\u6d4b\u548c\u5220\u9664\u7684\u65f6\u95f4\u6233\u6216\u552f\u4e00\u6807\u8bc6\u7b26\u3002\u8981\u5220\u9664\u57fa\u7ebf\u4e8b\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 k-\u6700\u8fd1\u90bb\u6a21\u5f0f\u8bc6\u522b\u7b97\u6cd5\uff08k-NN\uff09\u3002<\/p>\n
<\/p>\n
\u65e5\u5fd7\u4e8b\u4ef6\u5fc5\u987b\u8f6c\u6362\u4e3a\u53ef\u7528\u4e8e k-NN \u56de\u5f52\u7684\u6570\u503c\u3002\u4f7f\u7528\u901a\u7528\u7279\u5f81\u63d0\u53d6\u5de5\u5177 HashingVectorizer \u53ef\u4ee5\u5c06\u8be5\u8fc7\u7a0b\u5e94\u7528\u4e8e\u4efb\u4f55\u7c7b\u578b\u7684\u65e5\u5fd7\u3002\u5b83\u6563\u5217\u6bcf\u4e2a\u5355\u8bcd\u5e76\u5728\u7a00\u758f\u77e9\u9635\u4e2d\u5bf9\u6bcf\u4e2a\u4e8b\u4ef6\u8fdb\u884c\u7f16\u7801\u3002\u4e3a\u4e86\u8fdb\u4e00\u6b65\u51cf\u5c11\u641c\u7d22\u7a7a\u95f4\uff0c\u8fd9\u4e2a\u6807\u8bb0\u5316\u8fc7\u7a0b\u5220\u9664\u4e86\u5df2\u77e5\u7684\u968f\u673a\u5355\u8bcd\uff0c\u4f8b\u5982\u65e5\u671f\u6216 IP \u5730\u5740\u3002<\/p>\n
<\/p>\n
\u8bad\u7ec3\u6a21\u578b\u540e\uff0ck-NN \u641c\u7d22\u53ef\u4ee5\u544a\u8bc9\u6211\u4eec\u6bcf\u4e2a\u65b0\u4e8b\u4ef6\u4e0e\u57fa\u7ebf\u7684\u8ddd\u79bb\u3002<\/p>\n
<\/p>\n
\u8fd9\u4e2a Jupyter \u7b14\u8bb0\u672c \u6f14\u793a\u4e86\u8be5\u7a00\u758f\u77e9\u9635\u5411\u91cf\u7684\u5904\u7406\u548c\u56fe\u5f62\u3002<\/p>\n
<\/p>\n
Logreduce Python \u8f6f\u4ef6\u900f\u660e\u5730\u5b9e\u73b0\u4e86\u8fd9\u4e2a\u8fc7\u7a0b\u3002Logreduce \u7684\u6700\u521d\u76ee\u6807\u662f\u4f7f\u7528\u6784\u5efa\u6570\u636e\u5e93\u6765\u534f\u52a9\u5206\u6790 Zuul CI \u4f5c\u4e1a\u7684\u5931\u8d25\u95ee\u9898\uff0c\u73b0\u5728\u5b83\u5df2\u96c6\u6210\u5230 Software Factory \u5f00\u53d1\u8f66\u95f4\u7684\u4f5c\u4e1a\u65e5\u5fd7\u5904\u7406\u4e2d\u3002<\/p>\n
\u6700\u7b80\u5355\u7684\u662f\uff0cLogreduce \u4f1a\u6bd4\u8f83\u6587\u4ef6\u6216\u76ee\u5f55\u5e76\u5220\u9664\u76f8\u4f3c\u7684\u884c\u3002Logreduce \u4e3a\u6bcf\u4e2a\u6e90\u6587\u4ef6\u6784\u5efa\u6a21\u578b\uff0c\u5e76\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\u8f93\u51fa\u8ddd\u79bb\u9ad8\u4e8e\u5b9a\u4e49\u9608\u503c\u7684\u4efb\u4f55\u76ee\u6807\u884c\uff1adistance | filename:line-number: line-content\u3002<\/p>\n
$ logreduce diff \/var\/log\/audit\/audit.log.1 \/var\/log\/audit\/audit.log\r\nINFO \u00a0logreduce.Classifier - Training took 21.982s at 0.364MB\/s (1.314kl\/s) (8.000 MB - 28.884 kilo-lines)\r\n0.244 | audit.log:19963:\u00a0 \u00a0 \u00a0 \u00a0 type=USER_AUTH acct=\"root\" exe=\"\/usr\/bin\/su\" hostname=managesf.sftests.com\r\nINFO \u00a0logreduce.Classifier - Testing took 18.297s at 0.306MB\/s (1.094kl\/s) (5.607 MB - 20.015 kilo-lines)\r\n99.99% reduction (from 20015 lines to 1<\/pre>\n\u66f4\u9ad8\u7ea7\u7684 Logreduce \u7528\u6cd5\u53ef\u4ee5\u79bb\u7ebf\u8bad\u7ec3\u6a21\u578b\u4ee5\u4fbf\u91cd\u590d\u4f7f\u7528\u3002\u53ef\u4ee5\u4f7f\u7528\u57fa\u7ebf\u7684\u8bb8\u591a\u53d8\u4f53\u6765\u62df\u5408 k-NN \u641c\u7d22\u6811\u3002<\/p>\n
$ logreduce dir-train audit.clf \/var\/log\/audit\/audit.log.*\r\nINFO \u00a0logreduce.Classifier - Training took 80.883s at 0.396MB\/s (1.397kl\/s) (32.001 MB - 112.977 kilo-lines)\r\nDEBUG logreduce.Classifier - audit.clf: written\r\n$ logreduce dir-run audit.clf \/var\/log\/audit\/audit.log<\/pre>\nLogreduce \u8fd8\u5b9e\u73b0\u4e86\u63a5\u53e3\uff0c\u4ee5\u53d1\u73b0 Journald \u65f6\u95f4\u8303\u56f4\uff08\u5929\/\u5468\/\u6708\uff09\u548c Zuul CI \u4f5c\u4e1a\u6784\u5efa\u5386\u53f2\u7684\u57fa\u7ebf\u3002\u5b83\u8fd8\u53ef\u4ee5\u751f\u6210 HTML \u62a5\u544a\uff0c\u8be5\u62a5\u544a\u5728\u4e00\u4e2a\u7b80\u5355\u7684\u754c\u9762\u4e2d\u5c06\u5728\u591a\u4e2a\u6587\u4ef6\u4e2d\u53d1\u73b0\u7684\u5f02\u5e38\u8fdb\u884c\u5206\u7ec4\u3002<\/p>\n
<\/p>\n
\u7ba1\u7406\u57fa\u7ebf<\/strong><\/div>\n\u4f7f\u7528 k-NN \u56de\u5f52\u8fdb\u884c\u5f02\u5e38\u68c0\u6d4b\u7684\u5173\u952e\u662f\u62e5\u6709\u4e00\u4e2a\u5df2\u77e5\u826f\u597d\u57fa\u7ebf\u7684\u6570\u636e\u5e93\uff0c\u8be5\u6a21\u578b\u4f7f\u7528\u6570\u636e\u5e93\u6765\u68c0\u6d4b\u504f\u79bb\u592a\u8fdc\u7684\u65e5\u5fd7\u884c\u3002\u6b64\u65b9\u6cd5\u4f9d\u8d56\u4e8e\u5305\u542b\u6240\u6709\u6807\u79f0\u4e8b\u4ef6\u7684\u57fa\u7ebf\uff0c\u56e0\u4e3a\u57fa\u7ebf\u4e2d\u672a\u627e\u5230\u7684\u4efb\u4f55\u5185\u5bb9\u90fd\u5c06\u62a5\u544a\u4e3a\u5f02\u5e38\u3002<\/p>\n
CI \u4f5c\u4e1a\u662f k-NN \u56de\u5f52\u7684\u91cd\u8981\u76ee\u6807\uff0c\u56e0\u4e3a\u4f5c\u4e1a\u7684\u8f93\u51fa\u901a\u5e38\u662f\u786e\u5b9a\u6027\u7684\uff0c\u4e4b\u524d\u7684\u8fd0\u884c\u7ed3\u679c\u53ef\u4ee5\u81ea\u52a8\u7528\u4f5c\u57fa\u7ebf\u3002 Logreduce \u5177\u6709 Zuul \u4f5c\u4e1a\u89d2\u8272\uff0c\u53ef\u4ee5\u5c06\u5176\u7528\u4f5c\u5931\u8d25\u7684\u4f5c\u4e1a\u53d1\u5e03\u4efb\u52a1\u7684\u4e00\u90e8\u5206\uff0c\u4ee5\u4fbf\u53d1\u5e03\u7b80\u660e\u62a5\u544a\uff08\u800c\u4e0d\u662f\u5b8c\u6574\u4f5c\u4e1a\u7684\u65e5\u5fd7\uff09\u3002\u53ea\u8981\u53ef\u4ee5\u63d0\u524d\u6784\u5efa\u57fa\u7ebf\uff0c\u8be5\u539f\u5219\u5c31\u53ef\u4ee5\u5e94\u7528\u4e8e\u5176\u4ed6\u60c5\u51b5\u3002\u4f8b\u5982\uff0c\u6807\u79f0\u7cfb\u7edf\u7684 SoS \u62a5\u544a \u53ef\u7528\u4e8e\u67e5\u627e\u7f3a\u9677\u90e8\u7f72\u4e2d\u7684\u95ee\u9898\u3002<\/p>\n
<\/p>\n
\u5f02\u5e38\u5206\u7c7b\u670d\u52a1<\/strong><\/div>\n\u4e0b\u4e00\u7248\u672c\u7684 Logreduce \u5f15\u5165\u4e86\u4e00\u79cd\u670d\u52a1\u5668\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5c06\u65e5\u5fd7\u5904\u7406\u5378\u8f7d\u5230\u5916\u90e8\u670d\u52a1\uff0c\u5728\u5916\u90e8\u670d\u52a1\u4e2d\u53ef\u4ee5\u8fdb\u4e00\u6b65\u5206\u6790\u8be5\u62a5\u544a\u3002\u5b83\u8fd8\u652f\u6301\u5bfc\u5165\u73b0\u6709\u62a5\u544a\u548c\u8bf7\u6c42\u4ee5\u5206\u6790 Zuul \u6784\u5efa\u3002\u8fd9\u4e9b\u670d\u52a1\u4ee5\u5f02\u6b65\u65b9\u5f0f\u8fd0\u884c\u5206\u6790\uff0c\u5e76\u5177\u6709 Web \u754c\u9762\u4ee5\u8c03\u6574\u5206\u6570\u5e76\u6d88\u9664\u8bef\u62a5\u3002<\/p>\n
<\/p>\n
\u5df2\u5ba1\u6838\u7684\u62a5\u544a\u53ef\u4ee5\u4f5c\u4e3a\u72ec\u7acb\u6570\u636e\u96c6\u5b58\u6863\uff0c\u5176\u4e2d\u5305\u542b\u76ee\u6807\u65e5\u5fd7\u6587\u4ef6\u548c\u8bb0\u5f55\u5728\u4e00\u4e2a\u666e\u901a\u7684 JSON \u6587\u4ef6\u4e2d\u7684\u5f02\u5e38\u884c\u7684\u5206\u6570\u3002<\/p>\n
\u9879\u76ee\u8def\u7ebf\u56fe<\/strong><\/div>\nLogreduce \u5df2\u7ecf\u80fd\u6709\u6548\u4f7f\u7528\uff0c\u4f46\u662f\u6709\u5f88\u591a\u673a\u4f1a\u6765\u6539\u8fdb\u8be5\u5de5\u5177\u3002\u672a\u6765\u7684\u8ba1\u5212\u5305\u62ec\uff1a<\/p>\n
\n
- \u7b56\u5212\u5728\u65e5\u5fd7\u6587\u4ef6\u4e2d\u53d1\u73b0\u7684\u8bb8\u591a\u5e26\u6ce8\u91ca\u7684\u5f02\u5e38\uff0c\u5e76\u751f\u6210\u4e00\u4e2a\u516c\u5171\u57df\u6570\u636e\u96c6\u4ee5\u8fdb\u884c\u8fdb\u4e00\u6b65\u7814\u7a76\u3002\u65e5\u5fd7\u6587\u4ef6\u4e2d\u7684\u5f02\u5e38\u68c0\u6d4b\u662f\u4e00\u4e2a\u5177\u6709\u6311\u6218\u6027\u7684\u4e3b\u9898\uff0c\u5e76\u4e14\u6709\u4e00\u4e2a\u7528\u4e8e\u6d4b\u8bd5\u65b0\u6a21\u578b\u7684\u901a\u7528\u6570\u636e\u96c6\u5c06\u6709\u52a9\u4e8e\u8bc6\u522b\u65b0\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/li>\n
- \u91cd\u590d\u4f7f\u7528\u5e26\u6ce8\u91ca\u7684\u5f02\u5e38\u6a21\u578b\u6765\u4f18\u5316\u6240\u62a5\u544a\u7684\u8ddd\u79bb\u3002\u4f8b\u5982\uff0c\u5f53\u7528\u6237\u901a\u8fc7\u5c06\u8ddd\u79bb\u8bbe\u7f6e\u4e3a\u96f6\u6765\u5c06\u65e5\u5fd7\u884c\u6807\u8bb0\u4e3a\u8bef\u62a5\u65f6\uff0c\u6a21\u578b\u53ef\u80fd\u4f1a\u964d\u4f4e\u672a\u6765\u62a5\u544a\u4e2d\u8fd9\u4e9b\u65e5\u5fd7\u884c\u7684\u5f97\u5206\u3002<\/li>\n
- \u5bf9\u5b58\u6863\u5f02\u5e38\u53d6\u6307\u7eb9\u7279\u5f81\u4ee5\u68c0\u6d4b\u65b0\u62a5\u544a\u4f55\u65f6\u5305\u542b\u5df2\u77e5\u7684\u5f02\u5e38\u3002\u56e0\u6b64\uff0c\u8be5\u670d\u52a1\u53ef\u4ee5\u901a\u77e5\u7528\u6237\u8be5\u4f5c\u4e1a\u9047\u5230\u5df2\u77e5\u95ee\u9898\uff0c\u800c\u4e0d\u662f\u62a5\u544a\u5f02\u5e38\u7684\u5185\u5bb9\u3002\u89e3\u51b3\u95ee\u9898\u540e\uff0c\u8be5\u670d\u52a1\u53ef\u4ee5\u81ea\u52a8\u91cd\u65b0\u542f\u52a8\u8be5\u4f5c\u4e1a\u3002<\/li>\n
- \u652f\u6301\u66f4\u591a\u57fa\u51c6\u53d1\u73b0\u63a5\u53e3\uff0c\u7528\u4e8e SOS \u62a5\u544a\u3001Jenkins \u6784\u5efa\u3001Travis CI \u7b49\u76ee\u6807\u3002<\/li>\n<\/ul>\n
\u5982\u679c\u4f60\u6709\u5174\u8da3\u53c2\u4e0e\u6b64\u9879\u76ee\uff0c\u8bf7\u901a\u8fc7 \uff03log-classify Freenode IRC \u9891\u9053\u4e0e\u6211\u4eec\u8054\u7cfb\u3002\u6b22\u8fce\u53cd\u9988\uff01<\/p>\n
\nvia: https:\/\/opensource.com\/article\/18\/9\/quiet-log-noise-python-and-machine-learning<\/a><\/p>\n
\u4f5c\u8005\uff1aTristan de Cacqueray<\/a> \u9009\u9898\uff1alujun9972<\/a> \u8bd1\u8005\uff1awxy<\/a> \u6821\u5bf9\uff1awxy<\/a><\/p>\n
\u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n","protected":false},"excerpt":{"rendered":"
\u6301\u7eed\u96c6\u6210\uff08CI\uff09\u4f5c\u4e1a\u4f1a\u751f\u6210\u5927\u91cf\u6570\u636e\u3002\u5f53\u4e00\u4e2a\u4f5c\u4e1a\u5931\u8d25\u65f6\uff0c\u5f04\u6e05\u695a\u51fa\u4e86\u4ec0\u4e48\u95ee\u9898\u53ef\u80fd\u662f\u4e00\u4e2a\u7e41\u7410\u7684\u8fc7\u7a0b\uff0c\u5b83\u6d89\u53ca\u5230\u8c03\u67e5\u65e5\u5fd7 […]<\/p>\n","protected":false},"author":323,"featured_media":118960,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-153117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/153117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/323"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=153117"}],"version-history":[{"count":2,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/153117\/revisions"}],"predecessor-version":[{"id":153194,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/153117\/revisions\/153194"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/118960"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=153117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=153117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=153117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}