{"id":3144,"date":"2026-02-06T14:22:25","date_gmt":"2026-02-06T06:22:25","guid":{"rendered":"https:\/\/linuxjk.cn\/?p=3144"},"modified":"2026-02-06T14:22:29","modified_gmt":"2026-02-06T06:22:29","slug":"linux%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%bc%80%e5%90%af%e6%97%a5%e5%bf%97%e8%bd%ae%e8%bd%ac%e4%bf%9d%e5%ad%98180%e5%a4%a9","status":"publish","type":"post","link":"https:\/\/linuxjk.cn\/?p=3144","title":{"rendered":"linux\u670d\u52a1\u5668\u5f00\u542f\u65e5\u5fd7\u8f6e\u8f6c\u4fdd\u5b58180\u5929"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_88 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxjk.cn\/?p=3144\/#%E8%AF%B4%E6%98%8E%EF%BC%9A%E6%9C%AC%E6%96%87%E9%80%82%E9%85%8Dcentos79%E9%85%8D%E7%BD%AE%E6%97%A5%E5%BF%97%E8%BD%AE%E8%BD%AC%EF%BC%8C%E6%AF%8F%E5%91%A8%E8%BD%AE%E8%BD%AC%EF%BC%8C%E5%85%B1%E4%BF%9D%E5%AD%98182%E5%A4%A9\" >\u8bf4\u660e\uff1a\u672c\u6587\u9002\u914dcentos7.9\u914d\u7f6e\u65e5\u5fd7\u8f6e\u8f6c\uff0c\u6bcf\u5468\u8f6e\u8f6c\uff0c\u5171\u4fdd\u5b58182\u5929<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxjk.cn\/?p=3144\/#%E9%85%8D%E7%BD%AE%E5%89%8D%E6%A3%80%E6%9F%A5\" >\u914d\u7f6e\u524d\u68c0\u67e5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/linuxjk.cn\/?p=3144\/#%E9%85%8D%E7%BD%AE%E8%BF%87%E7%A8%8B\" >\u914d\u7f6e\u8fc7\u7a0b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/linuxjk.cn\/?p=3144\/#%E5%AE%8C%E6%95%B4%E5%8A%9F%E8%83%BD%E9%AA%8C%E8%AF%81\" >\u5b8c\u6574\u529f\u80fd\u9a8c\u8bc1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/linuxjk.cn\/?p=3144\/#%E8%87%AA%E5%8A%A8%E5%8C%96%E8%84%9A%E6%9C%AC%EF%BC%9Asetup_log_rotationsh\" >\u81ea\u52a8\u5316\u811a\u672c\uff1asetup_log_rotation.sh<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/linuxjk.cn\/?p=3144\/#%E6%B5%8B%E8%AF%95%E9%AA%8C%E8%AF%81\" >\u6d4b\u8bd5\u9a8c\u8bc1<\/a><\/li><\/ul><\/nav><\/div>\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%AF%B4%E6%98%8E%EF%BC%9A%E6%9C%AC%E6%96%87%E9%80%82%E9%85%8Dcentos79%E9%85%8D%E7%BD%AE%E6%97%A5%E5%BF%97%E8%BD%AE%E8%BD%AC%EF%BC%8C%E6%AF%8F%E5%91%A8%E8%BD%AE%E8%BD%AC%EF%BC%8C%E5%85%B1%E4%BF%9D%E5%AD%98182%E5%A4%A9\"><\/span>\u8bf4\u660e\uff1a\u672c\u6587\u9002\u914dcentos7.9\u914d\u7f6e\u65e5\u5fd7\u8f6e\u8f6c\uff0c\u6bcf\u5468\u8f6e\u8f6c\uff0c\u5171\u4fdd\u5b58182\u5929<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>linux\u670d\u52a1\u5668\u5f00\u542f\u65e5\u5fd7\u5ba1\u8ba1\u529f\u80fd\uff0c\u53ef\u5bf9audit\u65e5\u5fd7\u3001messages\u65e5\u5fd7\u3001cron\u65e5\u5fd7\u3001secure\u65e5\u5fd7\u8fdb\u884c\u8bb0\u5f55\uff0c\u670d\u52a1\u5668\u672c\u5730\u65e5\u5fd7\u5ba1\u8ba1\u65f6\u95f4\u5747\u672a\u6ee1\u8db36\u4e2a\u6708\uff0c\u65e5\u5fd7\u5df2\u4e0a\u4f20\u65e5\u5fd7\u5ba1\u8ba1\uff0c\u4f46\u4ec5\u80fd\u67e5\u770b\u5230178\u5929\u7684\u65e5\u5fd7\u3002<\/th><th>Web\u670d\u52a1\u5668 \uff08172.22.3.2\uff09 \u6570\u636e\u5e93\u670d\u52a1\u56681 \uff08172.22.3.129\uff09 \u6570\u636e\u5e93\u670d\u52a1\u56682 \uff08172.22.3.130\uff09 \u5e94\u7528\u670d\u52a1\u5668 \uff08172.22.3.131\uff09 Web\u670d\u52a1\u5668 \uff08172.22.3.3\uff09 \u6570\u636e\u5e93\u670d\u52a1\u5668 \uff08172.22.3.133\uff09 \u5e94\u7528\u670d\u52a1\u56681 \uff08172.22.3.134\uff09 \u5e94\u7528\u670d\u52a1\u56682 \uff08172.22.3.135\uff09<\/th><th>\u9ad8<\/th><th>\u5efa\u8baeLinux\u670d\u52a1\u5668\u914d\u7f6e\u65e5\u5fd7\u8f6e\u8be2\uff0c\u65e2\u4ee5\u5468\u4e3a\u5355\u4f4d\u8f6e\u8be2 26 \u6b21\uff0c\u5373 182\u5929(6\u4e2a\u6708\u5de6\u53f3)\uff0c\u6bcf\u5468\u538b\u7f29\u4fdd\u5b58\u65e5\u5fd7\uff0c\u65e5\u5fd7\u6587\u4ef6\u4ee5\u65e5\u671f\u4f5c\u4e3a\u6269\u5c55\u540d\uff0c\u5ffd\u7565\u9519\u8bef\uff0c\u5ffd\u7565\u7a7a\u6587\u4ef6\uff0c\u5ef6\u8fdf\u538b\u7f29\uff0c\u6700\u7ec8\u8fbe\u5230\u672c\u5730\u65e5\u5fd7\u4fdd\u5b58\u7684\u76ee\u7684\uff0c\u4fdd\u8bc1\u65e5\u5fd7\u5b58\u50a8\u65f6\u95f4\u8fbe\u52306\u4e2a\u6708\u4ee5\u4e0a\u3002<\/th><\/tr><\/thead><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E9%85%8D%E7%BD%AE%E5%89%8D%E6%A3%80%E6%9F%A5\"><\/span>\u914d\u7f6e\u524d\u68c0\u67e5<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u67e5\u770b\u7cfb\u7edf\u7248\u672c<br>cat \/etc\/redhat-release<br># \u68c0\u67e5 rsyslog \u670d\u52a1<br>systemctl status rsyslog<br># \u68c0\u67e5 logrotate \u72b6\u6001\u6587\u4ef6<br>cat \/var\/lib\/logrotate\/logrotate.status<br># \u67e5\u770b\u6709\u6548\u914d\u7f6e\uff08\u53bb\u9664\u6ce8\u91ca\u548c\u7a7a\u884c\uff09<br>cat \/etc\/rsyslog.conf | grep -v \"^#\" | grep -v \"^$\"<br># \u6d4b\u8bd5\u914d\u7f6e\u8bed\u6cd5<br>rsyslogd -N1<br># \u67e5\u770b SELinux \u72b6\u6001\uff08selinux\u5207\u6362Permissive\uff09<br>getenforce<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E9%85%8D%E7%BD%AE%E8%BF%87%E7%A8%8B\"><\/span>\u914d\u7f6e\u8fc7\u7a0b<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u521b\u5efa\u65e5\u5fd7\u6587\u4ef6<br>sudo touch \/var\/log\/cron \/var\/log\/{messages,secure,cron,maillog}<br># \u8bbe\u7f6e\u6743\u9650<br>sudo chmod 600 \/var\/log\/cron \/var\/log\/{messages,secure,cron,maillog}<br># \u8bbe\u7f6e\u6240\u6709\u8005<br>sudo chown root:root \/var\/log\/cron \/var\/log\/{messages,secure,cron,maillog}<br># \u9a8c\u8bc1<br>ls -lh \/var\/log\/{messages,secure,cron,maillog}<br>\u200b<br># \u5907\u4efd syslog \u914d\u7f6e<br>cp \/etc\/logrotate.d\/syslog \/etc\/logrotate.d\/syslog.bak.$(date +%Y%m%d)<br># \u9a8c\u8bc1\u5907\u4efd<br>ls -lh \/etc\/logrotate.d\/syslog*<br>\u200b<br>\u200b<br>cat &gt; \/etc\/logrotate.d\/syslog &lt;&lt; 'EOF'<br>\/var\/log\/cron<br>\/var\/log\/maillog<br>\/var\/log\/messages<br>\/var\/log\/secure<br>\/var\/log\/spooler<br>{<br>  weekly<br>  rotate 26<br>  create 0600 root root<br>  compress<br>  delaycompress<br>  missingok<br>  notifempty<br>  dateext<br>  dateformat -%Y%m%d<br>  sharedscripts<br>  postrotate<br> &nbsp;  \/bin\/kill -HUP `cat \/var\/run\/rsyslogd.pid 2&gt; \/dev\/null` 2&gt; \/dev\/null || true<br>  endscript<br>}<br>EOF<br>\u200b<br># \u6d4b\u8bd5\u914d\u7f6e\u8bed\u6cd5\uff08debug \u6a21\u5f0f\uff09<br>logrotate -dv \/etc\/logrotate.d\/syslog<br># \u67e5\u770b\u5f53\u524d\u8f6e\u8f6c\u72b6\u6001<br>cat \/var\/lib\/logrotate\/logrotate.status<br>\u200b<br>\u200b<br>\u200b<br># \u4e34\u65f6\u7981\u7528<br>setenforce 0<br># \u9a8c\u8bc1<br>getenforce<br># \u91cd\u542f\u670d\u52a1<br>systemctl restart rsyslog<br># \u68c0\u67e5\u670d\u52a1\u72b6\u6001<br>systemctl status rsyslog<br>\u200b<br># \u5199\u5165\u6d4b\u8bd5\u65e5\u5fd7<br>logger -p cron.info \"Test cron log entry\"<br>logger -p mail.info \"Test mail log entry\"<br>logger -p auth.info \"Test auth log entry\"<br>logger \"Test general message\"<br>\u200b<br># \u67e5\u770b\u65e5\u5fd7\u6587\u4ef6<br>ls -lh \/var\/log\/{messages,secure,cron,maillog}<br>\u200b<br># \u67e5\u770b\u65e5\u5fd7\u5185\u5bb9<br>echo \"=== messages ===\"<br>tail -3 \/var\/log\/messages<br>echo \"=== secure ===\"<br>tail -3 \/var\/log\/secure<br>echo \"=== cron ===\"<br>tail -3 \/var\/log\/cron<br>echo \"=== maillog ===\"<br>tail -3 \/var\/log\/maillog<br>\u200b<br>#\u6d4b\u8bd5 logrotate \u8f6e\u8f6c<br># \u5f3a\u5236\u6267\u884c\u8f6e\u8f6c<br>logrotate -f \/etc\/logrotate.d\/syslog<br># \u67e5\u770b\u66f4\u65b0\u540e\u7684\u72b6\u6001<br>cat \/var\/lib\/logrotate\/logrotate.status<br># \u67e5\u770b\u8f6e\u8f6c\u540e\u7684\u6587\u4ef6<br>ls -lht \/var\/log\/{messages,secure,cron,maillog}*<br>\u200b<br># \u5199\u5165\u65b0\u65e5\u5fd7<br>logger -p cron.info \"After rotation test\"<br>logger -p mail.info \"After rotation test\"<br># \u67e5\u770b\u65b0\u65e5\u5fd7<br>tail -3 \/var\/log\/cron<br>tail -3 \/var\/log\/maillog<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%AE%8C%E6%95%B4%E5%8A%9F%E8%83%BD%E9%AA%8C%E8%AF%81\"><\/span>\u5b8c\u6574\u529f\u80fd\u9a8c\u8bc1<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\"># 1. \u68c0\u67e5\u6240\u6709\u65e5\u5fd7\u6587\u4ef6<br>ls -lh \/var\/log\/{messages,secure,cron,maillog}<br># 2. \u68c0\u67e5 rsyslog \u670d\u52a1<br>systemctl status rsyslog<br>\u200b<br># 3. \u5199\u5165\u6700\u7ec8\u6d4b\u8bd5\u65e5\u5fd7<br>logger \"Final verification - $(date)\"<br>logger -p cron.info \"Final verification - cron\"<br>logger -p mail.info \"Final verification - mail\"<br>logger -p auth.info \"Final verification - auth\"<br>\u200b<br># 4. \u9a8c\u8bc1\u65e5\u5fd7\u5199\u5165<br>tail -2 \/var\/log\/messages<br>tail -2 \/var\/log\/cron<br>tail -2 \/var\/log\/maillog<br>tail -2 \/var\/log\/secure<br>\u200b<br># 5. \u6d4b\u8bd5 logrotate \u914d\u7f6e<br>logrotate -dv \/etc\/logrotate.d\/syslog | head -20<br># 6. \u67e5\u770b\u8f6e\u8f6c\u5386\u53f2<br>ls -lht \/var\/log\/messages-* | head -5<br># 7. \u67e5\u770b cron \u5b9a\u65f6\u4efb\u52a1<br>ls -lh \/etc\/cron.daily\/logrotate<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%87%AA%E5%8A%A8%E5%8C%96%E8%84%9A%E6%9C%AC%EF%BC%9Asetup_log_rotationsh\"><\/span>\u81ea\u52a8\u5316\u811a\u672c\uff1a<code>setup_log_rotation.sh<\/code><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">#!\/bin\/bash<br>#<br># \u811a\u672c\u540d\u79f0: setup_log_rotation.sh<br># \u529f\u80fd\u63cf\u8ff0: CentOS 7.9 \u7cfb\u7edf\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u81ea\u52a8\u5316\u811a\u672c<br># \u7248\u672c: 1.1 (\u4fee\u590d\u7248)<br>#<br>\u200b<br># \u79fb\u9664\u5168\u5c40 set -e\uff0c\u6539\u4e3a\u5c40\u90e8\u9519\u8bef\u5904\u7406<br># set -e  # \u6ce8\u91ca\u6389\u8fd9\u884c<br>\u200b<br># \u989c\u8272\u5b9a\u4e49<br>RED='\\033[0;31m'<br>GREEN='\\033[0;32m'<br>YELLOW='\\033[1;33m'<br>BLUE='\\033[0;34m'<br>NC='\\033[0m' # No Color<br>\u200b<br># \u65e5\u5fd7\u51fd\u6570<br>log_info() {<br> &nbsp; &nbsp;echo -e \"${GREEN}[INFO]${NC} $1\"<br>}<br>\u200b<br>log_warn() {<br> &nbsp; &nbsp;echo -e \"${YELLOW}[WARN]${NC} $1\"<br>}<br>\u200b<br>log_error() {<br> &nbsp; &nbsp;echo -e \"${RED}[ERROR]${NC} $1\"<br>}<br>\u200b<br>log_section() {<br> &nbsp; &nbsp;echo -e \"\\n${BLUE}========================================${NC}\"<br> &nbsp; &nbsp;echo -e \"${BLUE}$1${NC}\"<br> &nbsp; &nbsp;echo -e \"${BLUE}========================================${NC}\\n\"<br>}<br>\u200b<br># \u68c0\u67e5\u662f\u5426\u4e3a root \u7528\u6237<br>check_root() {<br> &nbsp; &nbsp;if [[ $EUID -ne 0 ]]; then<br> &nbsp; &nbsp; &nbsp;  log_error \"\u6b64\u811a\u672c\u5fc5\u987b\u4ee5 root \u7528\u6237\u8fd0\u884c\"<br> &nbsp; &nbsp; &nbsp; &nbsp;exit 1<br> &nbsp; &nbsp;fi<br>}<br>\u200b<br># \u914d\u7f6e\u524d\u68c0\u67e5<br>pre_check() {<br> &nbsp;  log_section \"1. \u914d\u7f6e\u524d\u68c0\u67e5\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u7cfb\u7edf\u7248\u672c\uff1a\"<br> &nbsp; &nbsp;cat \/etc\/redhat-release<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u68c0\u67e5 rsyslog \u670d\u52a1\u72b6\u6001\uff1a\"<br> &nbsp;  systemctl status rsyslog --no-pager || true<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u5f53\u524d logrotate \u72b6\u6001\uff1a\"<br> &nbsp; &nbsp;cat \/var\/lib\/logrotate\/logrotate.status | grep -E \"cron|maillog|messages|secure\" || true<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"rsyslog \u6709\u6548\u914d\u7f6e\uff1a\"<br> &nbsp; &nbsp;cat \/etc\/rsyslog.conf | grep -v \"^#\" | grep -v \"^$\" | head -20<br> &nbsp;  echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u6d4b\u8bd5 rsyslog \u914d\u7f6e\u8bed\u6cd5\uff1a\"<br> &nbsp;  rsyslogd -N1<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u5f53\u524d SELinux \u72b6\u6001\uff1a\"<br> &nbsp;  getenforce<br> &nbsp; &nbsp;echo \"\"<br>}<br>\u200b<br># \u521b\u5efa\u65e5\u5fd7\u6587\u4ef6<br>create_log_files() {<br> &nbsp;  log_section \"2. \u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6...\"<br> &nbsp; &nbsp;touch \/var\/log\/cron \/var\/log\/maillog \/var\/log\/messages \/var\/log\/secure 2&gt;\/dev\/null || true<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u8bbe\u7f6e\u65e5\u5fd7\u6587\u4ef6\u6743\u9650\u4e3a 600...\"<br> &nbsp; &nbsp;chmod 600 \/var\/log\/{messages,secure,cron,maillog}<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u8bbe\u7f6e\u65e5\u5fd7\u6587\u4ef6\u6240\u6709\u8005\u4e3a root:root...\"<br> &nbsp; &nbsp;chown root:root \/var\/log\/{messages,secure,cron,maillog}<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u9a8c\u8bc1\u65e5\u5fd7\u6587\u4ef6\uff1a\"<br> &nbsp; &nbsp;ls -lh \/var\/log\/{messages,secure,cron,maillog}<br> &nbsp; &nbsp;echo \"\"<br>}<br>\u200b<br># \u5907\u4efd\u5e76\u914d\u7f6e logrotate<br>configure_logrotate() {<br> &nbsp;  log_section \"3. \u914d\u7f6e logrotate\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u5907\u4efd\u539f\u914d\u7f6e\u6587\u4ef6...\"<br> &nbsp; &nbsp;cp \/etc\/logrotate.d\/syslog \/etc\/logrotate.d\/syslog.bak.$(date +%Y%m%d_%H%M%S)<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u9a8c\u8bc1\u5907\u4efd\uff1a\"<br> &nbsp; &nbsp;ls -lh \/etc\/logrotate.d\/syslog* | tail -3<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u5199\u5165\u65b0\u7684 logrotate \u914d\u7f6e...\"<br> &nbsp; &nbsp;cat &gt; \/etc\/logrotate.d\/syslog &lt;&lt; 'EOF'<br>\/var\/log\/cron<br>\/var\/log\/maillog<br>\/var\/log\/messages<br>\/var\/log\/secure<br>\/var\/log\/spooler<br>{<br>  weekly<br>  rotate 26<br>  create 0600 root root<br>  compress<br>  delaycompress<br>  missingok<br>  notifempty<br>  dateext<br>  dateformat -%Y%m%d<br>  sharedscripts<br>  postrotate<br> &nbsp;  \/bin\/kill -HUP `cat \/var\/run\/rsyslogd.pid 2&gt; \/dev\/null` 2&gt; \/dev\/null || true<br>  endscript<br>}<br>EOF<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u65b0\u914d\u7f6e\u5185\u5bb9\uff1a\"<br> &nbsp; &nbsp;cat \/etc\/logrotate.d\/syslog<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u6d4b\u8bd5 logrotate \u914d\u7f6e\u8bed\u6cd5\uff1a\"<br> &nbsp;  logrotate -dv \/etc\/logrotate.d\/syslog 2&gt;&amp;1 | head -30<br> &nbsp; &nbsp;echo \"\"<br>}<br>\u200b<br># SELinux \u5904\u7406<br>handle_selinux() {<br> &nbsp;  log_section \"4. SELinux \u914d\u7f6e\"<br> &nbsp; &nbsp;<br> &nbsp;  local current_mode=$(getenforce)<br> &nbsp;  log_info \"\u5f53\u524d SELinux \u6a21\u5f0f: $current_mode\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;if [[ \"$current_mode\" == \"Enforcing\" ]]; then<br> &nbsp; &nbsp; &nbsp;  log_warn \"\u68c0\u6d4b\u5230 SELinux \u4e3a Enforcing \u6a21\u5f0f\"<br> &nbsp; &nbsp; &nbsp;  read -p \"\u662f\u5426\u4e34\u65f6\u5207\u6362\u5230 Permissive \u6a21\u5f0f\u4ee5\u4fbf\u6d4b\u8bd5\uff1f(y\/n): \" choice<br> &nbsp; &nbsp; &nbsp; &nbsp;<br> &nbsp; &nbsp; &nbsp; &nbsp;if [[ \"$choice\" == \"y\" || \"$choice\" == \"Y\" ]]; then<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  log_info \"\u4e34\u65f6\u7981\u7528 SELinux...\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  setenforce 0<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  log_info \"\u65b0\u7684 SELinux \u72b6\u6001\uff1a\"<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  getenforce<br> &nbsp; &nbsp; &nbsp; &nbsp;else<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  log_info \"\u4fdd\u6301\u5f53\u524d SELinux \u72b6\u6001\"<br> &nbsp; &nbsp; &nbsp; &nbsp;fi<br> &nbsp; &nbsp;fi<br> &nbsp; &nbsp;echo \"\"<br>}<br>\u200b<br># \u91cd\u542f rsyslog \u670d\u52a1<br>restart_rsyslog() {<br> &nbsp;  log_section \"5. \u91cd\u542f rsyslog \u670d\u52a1\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u91cd\u542f rsyslog \u670d\u52a1...\"<br> &nbsp;  systemctl restart rsyslog<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u68c0\u67e5\u670d\u52a1\u72b6\u6001\uff1a\"<br> &nbsp;  systemctl status rsyslog --no-pager<br> &nbsp; &nbsp;echo \"\"<br>}<br>\u200b<br># \u6d4b\u8bd5\u65e5\u5fd7\u5199\u5165<br>test_logging() {<br> &nbsp;  log_section \"6. \u6d4b\u8bd5\u65e5\u5fd7\u5199\u5165\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u5199\u5165\u6d4b\u8bd5\u65e5\u5fd7...\"<br> &nbsp;  logger -p cron.info \"Test cron log entry\"<br> &nbsp;  logger -p mail.info \"Test mail log entry\"<br> &nbsp;  logger -p auth.info \"Test auth log entry\"<br> &nbsp;  logger \"Test general message\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;sleep 2<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u67e5\u770b\u65e5\u5fd7\u6587\u4ef6\uff1a\"<br> &nbsp; &nbsp;ls -lh \/var\/log\/{messages,secure,cron,maillog}<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== messages ===${NC}\"<br> &nbsp;  tail -3 \/var\/log\/messages<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== secure ===${NC}\"<br> &nbsp;  tail -3 \/var\/log\/secure<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== cron ===${NC}\"<br> &nbsp;  tail -3 \/var\/log\/cron<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== maillog ===${NC}\"<br> &nbsp;  tail -3 \/var\/log\/maillog<br> &nbsp; &nbsp;echo \"\"<br>}<br>\u200b<br># \u6d4b\u8bd5\u65e5\u5fd7\u8f6e\u8f6c (\u6539\u8fdb\u7248)<br>test_rotation() {<br> &nbsp;  log_section \"7. \u6d4b\u8bd5\u65e5\u5fd7\u8f6e\u8f6c\"<br> &nbsp; &nbsp;<br> &nbsp;  log_warn \"\u5373\u5c06\u8fdb\u884c\u5f3a\u5236\u65e5\u5fd7\u8f6e\u8f6c\u6d4b\u8bd5\"<br> &nbsp;  read -p \"\u786e\u8ba4\u7ee7\u7eed\uff1f(y\/n): \" choice<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;if [[ \"$choice\" != \"y\" &amp;&amp; \"$choice\" != \"Y\" ]]; then<br> &nbsp; &nbsp; &nbsp;  log_warn \"\u8df3\u8fc7\u8f6e\u8f6c\u6d4b\u8bd5\"<br> &nbsp; &nbsp; &nbsp;  return<br> &nbsp; &nbsp;fi<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u5f3a\u5236\u6267\u884c\u65e5\u5fd7\u8f6e\u8f6c...\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;# \u6355\u83b7 logrotate \u7684\u8f93\u51fa\u548c\u9519\u8bef<br> &nbsp; &nbsp;if logrotate -fv \/etc\/logrotate.d\/syslog &gt; \/tmp\/logrotate_output.log 2&gt;&amp;1; then<br> &nbsp; &nbsp; &nbsp;  log_info \"\u65e5\u5fd7\u8f6e\u8f6c\u6267\u884c\u6210\u529f\"<br> &nbsp; &nbsp; &nbsp; &nbsp;cat \/tmp\/logrotate_output.log<br> &nbsp; &nbsp;else<br> &nbsp; &nbsp; &nbsp;  local exit_code=$?<br> &nbsp; &nbsp; &nbsp;  log_error \"\u65e5\u5fd7\u8f6e\u8f6c\u6267\u884c\u5931\u8d25\uff0c\u9000\u51fa\u7801: $exit_code\"<br> &nbsp; &nbsp; &nbsp;  log_error \"\u9519\u8bef\u8be6\u60c5\uff1a\"<br> &nbsp; &nbsp; &nbsp; &nbsp;cat \/tmp\/logrotate_output.log<br> &nbsp; &nbsp; &nbsp; &nbsp;<br> &nbsp; &nbsp; &nbsp; &nbsp;# \u5373\u4f7f\u5931\u8d25\u4e5f\u7ee7\u7eed\u6267\u884c<br> &nbsp; &nbsp; &nbsp;  log_warn \"\u7ee7\u7eed\u6267\u884c\u540e\u7eed\u68c0\u67e5...\"<br> &nbsp; &nbsp;fi<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u67e5\u770b\u8f6e\u8f6c\u540e\u7684\u72b6\u6001\uff1a\"<br> &nbsp; &nbsp;cat \/var\/lib\/logrotate\/logrotate.status | grep -E \"cron|maillog|messages|secure\"<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u67e5\u770b\u8f6e\u8f6c\u540e\u7684\u6587\u4ef6\uff1a\"<br> &nbsp; &nbsp;ls -lht \/var\/log\/{messages,secure,cron,maillog}* 2&gt;\/dev\/null | head -10 || log_warn \"\u672a\u627e\u5230\u8f6e\u8f6c\u6587\u4ef6\"<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u68c0\u67e5\u65b0\u65e5\u5fd7\u6587\u4ef6\u662f\u5426\u521b\u5efa...\"<br> &nbsp; &nbsp;if [[ -f \/var\/log\/messages &amp;&amp; -f \/var\/log\/cron &amp;&amp; -f \/var\/log\/maillog &amp;&amp; -f \/var\/log\/secure ]]; then<br> &nbsp; &nbsp; &nbsp;  log_info \"\u2713 \u65b0\u65e5\u5fd7\u6587\u4ef6\u5df2\u521b\u5efa\"<br> &nbsp; &nbsp; &nbsp; &nbsp;ls -lh \/var\/log\/{messages,secure,cron,maillog}<br> &nbsp; &nbsp;else<br> &nbsp; &nbsp; &nbsp;  log_error \"\u2717 \u65b0\u65e5\u5fd7\u6587\u4ef6\u672a\u521b\u5efa\uff01\"<br> &nbsp; &nbsp; &nbsp;  log_info \"\u5c1d\u8bd5\u624b\u52a8\u521b\u5efa...\"<br> &nbsp; &nbsp; &nbsp; &nbsp;touch \/var\/log\/{messages,secure,cron,maillog}<br> &nbsp; &nbsp; &nbsp; &nbsp;chmod 600 \/var\/log\/{messages,secure,cron,maillog}<br> &nbsp; &nbsp; &nbsp; &nbsp;chown root:root \/var\/log\/{messages,secure,cron,maillog}<br> &nbsp; &nbsp; &nbsp;  systemctl restart rsyslog<br> &nbsp; &nbsp;fi<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u6d4b\u8bd5\u8f6e\u8f6c\u540e\u65e5\u5fd7\u5199\u5165...\"<br> &nbsp;  logger -p cron.info \"After rotation test\"<br> &nbsp;  logger -p mail.info \"After rotation test\"<br> &nbsp;  logger \"After rotation general test\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;sleep 2<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u9a8c\u8bc1\u65b0\u65e5\u5fd7\u5199\u5165\uff1a\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== cron (\u8f6e\u8f6c\u540e) ===${NC}\"<br> &nbsp; &nbsp;if [[ -f \/var\/log\/cron ]]; then<br> &nbsp; &nbsp; &nbsp;  tail -3 \/var\/log\/cron<br> &nbsp; &nbsp;else<br> &nbsp; &nbsp; &nbsp;  log_error \"\/var\/log\/cron \u4e0d\u5b58\u5728\"<br> &nbsp; &nbsp;fi<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== maillog (\u8f6e\u8f6c\u540e) ===${NC}\"<br> &nbsp; &nbsp;if [[ -f \/var\/log\/maillog ]]; then<br> &nbsp; &nbsp; &nbsp;  tail -3 \/var\/log\/maillog<br> &nbsp; &nbsp;else<br> &nbsp; &nbsp; &nbsp;  log_error \"\/var\/log\/maillog \u4e0d\u5b58\u5728\"<br> &nbsp; &nbsp;fi<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== messages (\u8f6e\u8f6c\u540e) ===${NC}\"<br> &nbsp; &nbsp;if [[ -f \/var\/log\/messages ]]; then<br> &nbsp; &nbsp; &nbsp;  tail -3 \/var\/log\/messages<br> &nbsp; &nbsp;else<br> &nbsp; &nbsp; &nbsp;  log_error \"\/var\/log\/messages \u4e0d\u5b58\u5728\"<br> &nbsp; &nbsp;fi<br> &nbsp; &nbsp;echo \"\"<br>}<br>\u200b<br># \u5b8c\u6574\u529f\u80fd\u9a8c\u8bc1<br>final_verification() {<br> &nbsp;  log_section \"8. \u5b8c\u6574\u529f\u80fd\u9a8c\u8bc1\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"1. \u68c0\u67e5\u6240\u6709\u65e5\u5fd7\u6587\u4ef6\uff1a\"<br> &nbsp; &nbsp;ls -lh \/var\/log\/{messages,secure,cron,maillog} 2&gt;\/dev\/null || log_error \"\u90e8\u5206\u65e5\u5fd7\u6587\u4ef6\u7f3a\u5931\"<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"2. \u68c0\u67e5 rsyslog \u670d\u52a1\uff1a\"<br> &nbsp;  systemctl status rsyslog --no-pager<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"3. \u5199\u5165\u6700\u7ec8\u6d4b\u8bd5\u65e5\u5fd7...\"<br> &nbsp;  logger \"Final verification - $(date)\"<br> &nbsp;  logger -p cron.info \"Final verification - cron\"<br> &nbsp;  logger -p mail.info \"Final verification - mail\"<br> &nbsp;  logger -p auth.info \"Final verification - auth\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;sleep 2<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"4. \u9a8c\u8bc1\u65e5\u5fd7\u5199\u5165\uff1a\"<br> &nbsp; &nbsp;echo -e \"${BLUE}=== messages ===${NC}\"<br> &nbsp;  tail -2 \/var\/log\/messages 2&gt;\/dev\/null || log_error \"\u65e0\u6cd5\u8bfb\u53d6 messages\"<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== cron ===${NC}\"<br> &nbsp;  tail -2 \/var\/log\/cron 2&gt;\/dev\/null || log_error \"\u65e0\u6cd5\u8bfb\u53d6 cron\"<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== maillog ===${NC}\"<br> &nbsp;  tail -2 \/var\/log\/maillog 2&gt;\/dev\/null || log_error \"\u65e0\u6cd5\u8bfb\u53d6 maillog\"<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"${BLUE}=== secure ===${NC}\"<br> &nbsp;  tail -2 \/var\/log\/secure 2&gt;\/dev\/null || log_error \"\u65e0\u6cd5\u8bfb\u53d6 secure\"<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"5. \u6d4b\u8bd5 logrotate \u914d\u7f6e\uff1a\"<br> &nbsp;  logrotate -dv \/etc\/logrotate.d\/syslog 2&gt;&amp;1 | head -20<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"6. \u67e5\u770b\u8f6e\u8f6c\u5386\u53f2\uff1a\"<br> &nbsp; &nbsp;ls -lht \/var\/log\/messages-* 2&gt;\/dev\/null | head -5 || log_warn \"\u6682\u65e0\u8f6e\u8f6c\u5386\u53f2\"<br> &nbsp; &nbsp;echo \"\"<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"7. \u67e5\u770b cron \u5b9a\u65f6\u4efb\u52a1\uff1a\"<br> &nbsp; &nbsp;ls -lh \/etc\/cron.daily\/logrotate<br> &nbsp; &nbsp;echo \"\"<br>}<br>\u200b<br># \u751f\u6210\u914d\u7f6e\u62a5\u544a<br>generate_report() {<br> &nbsp;  log_section \"9. \u914d\u7f6e\u62a5\u544a\"<br> &nbsp; &nbsp;<br> &nbsp;  local report_file=\"\/tmp\/log_rotation_report_$(date +%Y%m%d_%H%M%S).txt\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;cat &gt; \"$report_file\" &lt;&lt; EOF<br>========================================<br>\u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u62a5\u544a<br>========================================<br>\u751f\u6210\u65f6\u95f4: $(date)<br>\u4e3b\u673a\u540d: $(hostname)<br>\u7cfb\u7edf\u7248\u672c: $(cat \/etc\/redhat-release)<br>\u200b<br>\u3010\u914d\u7f6e\u6587\u4ef6\u3011<br>$(cat \/etc\/logrotate.d\/syslog)<br>\u200b<br>\u3010\u5f53\u524d\u65e5\u5fd7\u6587\u4ef6\u72b6\u6001\u3011<br>$(ls -lh \/var\/log\/{messages,secure,cron,maillog} 2&gt;\/dev\/null || echo \"\u90e8\u5206\u6587\u4ef6\u7f3a\u5931\")<br>\u200b<br>\u3010rsyslog \u670d\u52a1\u72b6\u6001\u3011<br>$(systemctl status rsyslog --no-pager 2&gt;&amp;1)<br>\u200b<br>\u3010logrotate \u72b6\u6001\u3011<br>$(cat \/var\/lib\/logrotate\/logrotate.status | grep -E \"cron|maillog|messages|secure\")<br>\u200b<br>\u3010\u8f6e\u8f6c\u5386\u53f2\u3011<br>$(ls -lht \/var\/log\/messages-* 2&gt;\/dev\/null | head -5 || echo \"\u65e0\u8f6e\u8f6c\u5386\u53f2\")<br>\u200b<br>\u3010SELinux \u72b6\u6001\u3011<br>$(getenforce)<br>\u200b<br>\u3010\u6700\u8fd1\u65e5\u5fd7\u6d4b\u8bd5\u3011<br>$(tail -3 \/var\/log\/messages 2&gt;\/dev\/null || echo \"\u65e0\u6cd5\u8bfb\u53d6\")<br>\u200b<br>========================================<br>\u914d\u7f6e\u5b8c\u6210\u72b6\u6001: \u6210\u529f<br>========================================<br>EOF<br> &nbsp; &nbsp;<br> &nbsp;  log_info \"\u914d\u7f6e\u62a5\u544a\u5df2\u751f\u6210: $report_file\"<br> &nbsp; &nbsp;cat \"$report_file\"<br>}<br>\u200b<br># \u4e3b\u51fd\u6570<br>main() {<br> &nbsp;  log_section \"CentOS 7.9 \u65e5\u5fd7\u8f6e\u8f6c\u914d\u7f6e\u811a\u672c v1.1\"<br> &nbsp; &nbsp;<br> &nbsp;  check_root<br> &nbsp;  pre_check<br> &nbsp;  create_log_files<br> &nbsp;  configure_logrotate<br> &nbsp;  handle_selinux<br> &nbsp;  restart_rsyslog<br> &nbsp;  test_logging<br> &nbsp;  test_rotation<br> &nbsp;  final_verification<br> &nbsp;  generate_report<br> &nbsp; &nbsp;<br> &nbsp;  log_section \"\u914d\u7f6e\u5b8c\u6210\"<br> &nbsp;  log_info \"\u6240\u6709\u6b65\u9aa4\u6267\u884c\u5b8c\u6bd5\uff01\"<br> &nbsp;  log_info \"\u65e5\u5fd7\u8f6e\u8f6c\u5c06\u5728\u6bcf\u5468\u81ea\u52a8\u6267\u884c\uff0c\u4fdd\u7559\u6700\u8fd1 26 \u5468\u7684\u65e5\u5fd7\"<br> &nbsp;  log_info \"\u65e7\u65e5\u5fd7\u5c06\u88ab\u538b\u7f29\u5b58\u50a8\uff0c\u6700\u65b0\u8f6e\u8f6c\u7684\u65e5\u5fd7\u4e0d\u538b\u7f29\"<br> &nbsp; &nbsp;<br> &nbsp; &nbsp;echo -e \"\\n${GREEN}\u2713 \u914d\u7f6e\u6210\u529f\u5b8c\u6210\uff01${NC}\\n\"<br>}<br>\u200b<br># \u6267\u884c\u4e3b\u51fd\u6570<br>main<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E9%AA%8C%E8%AF%81\"><\/span>\u6d4b\u8bd5\u9a8c\u8bc1<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">ls -lh \/var\/log\/{messages,secure,cron,maillog}* &amp;&amp; cat \/etc\/logrotate.d\/syslog &amp;&amp; hostname -I <\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/typora-zp.oss-cn-shanghai.aliyuncs.com\/typora20260119171003181.png\" alt=\"image-20260114110718062\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf4\u660e\uff1a\u672c\u6587\u9002\u914dcentos7.9\u914d\u7f6e\u65e5\u5fd7\u8f6e\u8f6c\uff0c\u6bcf\u5468\u8f6e\u8f6c\uff0c\u5171\u4fdd\u5b58182\u5929 linux\u670d\u52a1\u5668\u5f00\u542f\u65e5\u5fd7\u5ba1\u8ba1\u529f\u80fd\uff0c\u53ef\u5bf9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3144","post","type-post","status-publish","format-standard","hentry","category-vxhs888p"],"_links":{"self":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/3144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3144"}],"version-history":[{"count":1,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/3144\/revisions"}],"predecessor-version":[{"id":3145,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/3144\/revisions\/3145"}],"wp:attachment":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}