{"id":265,"date":"2022-01-12T16:41:50","date_gmt":"2022-01-12T08:41:50","guid":{"rendered":"http:\/\/learning.sino-vt.com:8988\/?p=265"},"modified":"2022-01-12T16:41:50","modified_gmt":"2022-01-12T08:41:50","slug":"auditsys%e7%b3%bb%e7%bb%9f%e6%97%a5%e5%bf%97%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"http:\/\/learning.sino-vt.com:8988\/index.php\/2022\/01\/12\/auditsys%e7%b3%bb%e7%bb%9f%e6%97%a5%e5%bf%97%e7%ae%a1%e7%90%86\/","title":{"rendered":"auditsys\u7cfb\u7edf\u65e5\u5fd7\u7ba1\u7406"},"content":{"rendered":"<table>\n<tbody>\n<tr>\n<td>1.center\u3001server\u3001statistic\u670d\u52a1\u5668\/var\/log\u4e0b\u7684auditsys\u65e5\u5fd7\u662f\u4e0d\u5206\u65e5\u671f\u5f80\u540e\u9762\u4e00\u76f4\u53e0\u52a0\u7684\uff0c\u65e5\u5fd7\u6587\u4ef6\u4f1a\u4e0d\u65ad\u589e\u5927\uff0c\u6709\u7684\u4f1a\u8fbe\u5230\u5341\u51e0\u751a\u81f3\u4e8c\u5341\u51e0G\u5927\u5c0f\uff0c\u5373\u5360\u7528\u7a7a\u95f4\u4e5f\u5f71\u54cd\u67e5\u8be2\u65e5\u5fd7\u6548\u7387\uff0c\u9700\u8981\u6211\u4eec\u624b\u52a8\u5220\u9664\u65e5\u5fd7\u3002\u5220\u9664\u7684\u65e5\u5fd7\u5df2\u7ecf\u540c\u6b65\u5230ES\u670d\u52a1\u5668\u4e86\uff0c\u6240\u4ee5\u4e0d\u5fc5\u62c5\u5fc3\u5220\u9664\u6389\u7684\u65e5\u5fd7\u5728\u63a7\u5236\u53f0\u90a3\u8fb9\u67e5\u8be2\u4e0d\u4e86\u3002\u4f46\u8981\u6ce8\u610f\u4e0d\u80fd\u76f4\u63a5\u5220\uff0c\u9700\u8981\u6309\u4ee5\u4e0b\u6b65\u9aa4\u6765\u64cd\u4f5c\uff1a<br \/>\n\u505c\u6b62\u670d\u52a1\uff1a systemctl stop filebeat\uff0c systemctl stop rsyslog<br \/>\n\u5220\u9664\u65e5\u5fd7\uff1arm -f \/var\/log\/auditsys*<br \/>\n\u542f\u52a8\u670d\u52a1\uff1a systemctl start filebeat\uff0c systemctl start rsyslog<br \/>\n\u68c0\u67e5\uff1a\u770b\/var\/log\u662f\u5426\u751f\u6210\u4e86\u65b0\u7684auditsys\u65e5\u5fd7<\/p>\n<p>2.ES\u670d\u52a1\u5668\u4e0a\u5173\u4e8e\u6211\u4eec\u7cfb\u7edf\u81ea\u8eab\u7684\u65e5\u5fd7\u7d22\u5f15\u53ef\u4ee5\u901a\u8fc7\u5728\u63a7\u5236\u53f0ES\u914d\u7f6e\u8fdb\u884c\u4fdd\u7559\u65f6\u95f4\u7684\u8bbe\u7f6e\uff0c\u4f46elasticsearch\u672c\u8eab\u7684\u65e5\u5fd7\u662f\u6ca1\u6709\u505a\u9650\u5236\u7684\uff0c\u4e00\u822c\u6b63\u5e38\u60c5\u51b5\u4e0belasticsearch\u7684\u65e5\u5fd7\u91cf\u5e76\u4e0d\u5927\uff0c\u4f46\u5982\u679c\u505a\u4e86\u52a0\u5bc6\u6216\u8005elasticsearch\u670d\u52a1\u6709\u5f02\u5e38\uff0c\u90a3\u4e48\u65e5\u5fd7\u91cf\u5c31\u4f1a\u975e\u5e38\u5927\uff08\u6709\u4e00\u4e2a\u5ba2\u6237\u51e0\u767eG\u7684\u78c1\u76d8\u5c31\u88ab\u65e5\u5fd7\u603c\u6ee1\u62a5\u8b66\u4e86\uff09\uff0c\u6240\u4ee5\u9700\u8981\u6211\u4eec\u624b\u52a8\u505a\u4e00\u4e2a\u5b9a\u65f6\u65e5\u5fd7\u6e05\u7406\u4efb\u52a1\uff1a<br \/>\n\u521b\u5efa\u65e5\u5fd7\u6e05\u7406\u811a\u672c\u76ee\u5f55\uff1amkdir \/usr\/local\/shell\/<br \/>\ncd\u5230\u8be5\u76ee\u5f55\uff1acd\u00a0\u00a0\/usr\/local\/shell\/<br \/>\n\u521b\u5efa\u65e5\u5fd7\u6e05\u7406\u811a\u672c\u6587\u4ef6\uff1avi delete_es_log.sh<br \/>\n#!\/bin\/sh<\/p>\n<p>find \/var\/log\/elasticsearch -mtime +10 -name &#8220;*.log&#8221; -exec rm -rf {} \\;\u00a0 \u00a0\u00a0 \u00a0##\u5220\u9664\/var\/log\/elasticsearch\u76ee\u5f55\u4e0b\u521b\u5efa\u4e8e10\u5929\u524d\u7684\u6587\u4ef6<br \/>\n\u8d4b\u4e88\u811a\u672c\u6267\u884c\u6743\u9650\uff1achmod +x delete_es_log.sh<br \/>\n\u589e\u52a0\u5b9a\u65f6\u4efb\u52a1\uff1avi \/etc\/cron.d\/es_crond<br \/>\n5 0 * * * root \/usr\/local\/shell\/delete_es_log.sh\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0 \u00a0\u00a0\u00a0##\u6bcf\u592900\uff1a05\u6267\u884c\u65e5\u5fd7\u6e05\u7406\u811a\u672c\u6587\u4ef6<br \/>\n\u91cd\u542f\u5b9a\u65f6\u670d\u52a1\uff1asystemctl restart crond<br \/>\n\u68c0\u67e5\uff1a\u73b0\u573a\u5de1\u68c0\u7684\u65f6\u5019\u53ef\u4ee5\u5c06\u5b9a\u65f6\u4efb\u52a1\u6539\u4e3a1\u5206\u949f\u6267\u884c\u4e00\u6b21\u68c0\u67e5\u662f\u5426\u751f\u6548<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.center\u3001server\u3001statistic\u670d\u52a1\u5668\/var\/log\u4e0b\u7684auditsys\u65e5\u5fd7\u662f\u4e0d\u5206\u65e5\u671f\u5f80\u540e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-265","post","type-post","status-publish","format-standard","hentry","category-auditsys"],"_links":{"self":[{"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/posts\/265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/comments?post=265"}],"version-history":[{"count":1,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/posts\/265\/revisions"}],"predecessor-version":[{"id":266,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/posts\/265\/revisions\/266"}],"wp:attachment":[{"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/media?parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/categories?post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/learning.sino-vt.com:8988\/index.php\/wp-json\/wp\/v2\/tags?post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}