


{"id":499,"date":"2026-07-09T15:31:26","date_gmt":"2026-07-09T08:31:26","guid":{"rendered":"https:\/\/blog.chaiyakul.com\/?p=499"},"modified":"2026-07-09T15:32:08","modified_gmt":"2026-07-09T08:32:08","slug":"del-log-var-log-old-1month-auto-centos-rhel","status":"publish","type":"post","link":"https:\/\/blog.chaiyakul.com\/index.php\/2026\/07\/09\/del-log-var-log-old-1month-auto-centos-rhel\/","title":{"rendered":"\u0e27\u0e34\u0e18\u0e35\u0e25\u0e1a\u0e44\u0e1f\u0e25\u0e4c Log \u0e43\u0e19 \/var\/log \u0e17\u0e35\u0e48\u0e40\u0e01\u0e48\u0e32\u0e01\u0e27\u0e48\u0e32 1 \u0e40\u0e14\u0e37\u0e2d\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e1a\u0e19 CentOS\/RHEL"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u0e1b\u0e31\u0e0d\u0e2b\u0e32<\/h2>\n\n\n\n<p>\u0e23\u0e30\u0e1a\u0e1a Linux \u0e42\u0e14\u0e22\u0e40\u0e09\u0e1e\u0e32\u0e30\u0e40\u0e0b\u0e34\u0e23\u0e4c\u0e1f\u0e40\u0e27\u0e2d\u0e23\u0e4c\u0e17\u0e35\u0e48\u0e17\u0e33\u0e07\u0e32\u0e19\u0e15\u0e48\u0e2d\u0e40\u0e19\u0e37\u0e48\u0e2d\u0e07\u0e40\u0e1b\u0e47\u0e19\u0e40\u0e27\u0e25\u0e32\u0e19\u0e32\u0e19 \u0e21\u0e31\u0e01\u0e21\u0e35\u0e44\u0e1f\u0e25\u0e4c Log \u0e43\u0e19 <code>\/var\/log<\/code> \u0e40\u0e1e\u0e34\u0e48\u0e21\u0e02\u0e36\u0e49\u0e19\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e22 \u0e46 \u0e2b\u0e32\u0e01\u0e44\u0e21\u0e48\u0e21\u0e35\u0e01\u0e32\u0e23\u0e08\u0e31\u0e14\u0e01\u0e32\u0e23 \u0e2d\u0e32\u0e08\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e1e\u0e37\u0e49\u0e19\u0e17\u0e35\u0e48\u0e14\u0e34\u0e2a\u0e01\u0e4c\u0e40\u0e15\u0e47\u0e21\u0e41\u0e25\u0e30\u0e2a\u0e48\u0e07\u0e1c\u0e25\u0e43\u0e2b\u0e49\u0e23\u0e30\u0e1a\u0e1a\u0e17\u0e33\u0e07\u0e32\u0e19\u0e1c\u0e34\u0e14\u0e1b\u0e01\u0e15\u0e34 \u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e02\u0e49\u0e32 GUI \u0e44\u0e14\u0e49<\/p>\n\n\n\n<p>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e21\u0e31\u0e01\u0e21\u0e35\u0e02\u0e19\u0e32\u0e14\u0e43\u0e2b\u0e0d\u0e48 \u0e44\u0e14\u0e49\u0e41\u0e01\u0e48<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>\/var\/log\/messages<\/code><\/li>\n\n\n\n<li><code>\/var\/log\/secure<\/code><\/li>\n\n\n\n<li><code>\/var\/log\/cron<\/code><\/li>\n\n\n\n<li><code>\/var\/log\/httpd\/*<\/code><\/li>\n\n\n\n<li><code>\/var\/log\/php-fpm\/*<\/code><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e27\u0e34\u0e18\u0e35\u0e17\u0e35\u0e48\u0e41\u0e19\u0e30\u0e19\u0e33: \u0e43\u0e0a\u0e49 Logrotate<\/h4>\n\n\n\n<p>\u0e23\u0e30\u0e1a\u0e1a CentOS\/RHEL \u0e21\u0e35\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21 <code>logrotate<\/code> \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e08\u0e31\u0e14\u0e01\u0e32\u0e23 Log \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2d\u0e22\u0e39\u0e48\u0e41\u0e25\u0e49\u0e27 \u0e44\u0e21\u0e48\u0e04\u0e27\u0e23\u0e43\u0e0a\u0e49 <code>cron<\/code> \u0e25\u0e1a\u0e44\u0e1f\u0e25\u0e4c\u0e40\u0e2d\u0e07\u0e42\u0e14\u0e22\u0e15\u0e23\u0e07 \u0e40\u0e1e\u0e23\u0e32\u0e30\u0e2d\u0e32\u0e08\u0e01\u0e23\u0e30\u0e17\u0e1a\u0e01\u0e32\u0e23\u0e17\u0e33\u0e07\u0e32\u0e19\u0e02\u0e2d\u0e07\u0e1a\u0e23\u0e34\u0e01\u0e32\u0e23\u0e15\u0e48\u0e32\u0e07 \u0e46<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e44\u0e1f\u0e25\u0e4c\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32<\/h4>\n\n\n\n<p>\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Log \u0e02\u0e2d\u0e07\u0e23\u0e30\u0e1a\u0e1a (<code>messages<\/code>, <code>secure<\/code>, <code>cron<\/code>) \u0e08\u0e30\u0e43\u0e0a\u0e49\u0e44\u0e1f\u0e25\u0e4c<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ncat \/etc\/logrotate.d\/rsyslog\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32\u0e43\u0e2b\u0e49\u0e40\u0e01\u0e47\u0e1a Log \u0e44\u0e27\u0e49 30 \u0e27\u0e31\u0e19<\/h4>\n\n\n\n<p>\u0e41\u0e01\u0e49\u0e44\u0e02\u0e44\u0e1f\u0e25\u0e4c<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nvi \/etc\/logrotate.d\/rsyslog\n<\/pre><\/div>\n\n\n<p>\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e04\u0e48\u0e32\u0e40\u0e1b\u0e47\u0e19\u0e14\u0e31\u0e07\u0e19\u0e35\u0e49<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\/var\/log\/cron\n\/var\/log\/maillog\n\/var\/log\/messages\n\/var\/log\/secure\n\/var\/log\/spooler\n{\n    daily\n    rotate 30\n    compress\n    delaycompress\n    missingok\n    notifempty\n    sharedscripts\n    postrotate\n        \/usr\/bin\/systemctl -s HUP kill rsyslog.service &gt;\/dev\/null 2&gt;&amp;1 || true\n    endscript\n}\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e04\u0e27\u0e32\u0e21\u0e2b\u0e21\u0e32\u0e22\u0e02\u0e2d\u0e07\u0e41\u0e15\u0e48\u0e25\u0e30\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07<\/th><th>\u0e04\u0e27\u0e32\u0e21\u0e2b\u0e21\u0e32\u0e22<\/th><\/tr><\/thead><tbody><tr><td><code>daily<\/code><\/td><td>\u0e2b\u0e21\u0e38\u0e19 Log \u0e17\u0e38\u0e01\u0e27\u0e31\u0e19<\/td><\/tr><tr><td><code>rotate 30<\/code><\/td><td>\u0e40\u0e01\u0e47\u0e1a\u0e22\u0e49\u0e2d\u0e19\u0e2b\u0e25\u0e31\u0e07 30 \u0e0a\u0e38\u0e14 (\u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13 30 \u0e27\u0e31\u0e19)<\/td><\/tr><tr><td><code>compress<\/code><\/td><td>\u0e1a\u0e35\u0e1a\u0e2d\u0e31\u0e14 Log \u0e40\u0e01\u0e48\u0e32\u0e40\u0e1b\u0e47\u0e19 <code>.gz<\/code><\/td><\/tr><tr><td><code>delaycompress<\/code><\/td><td>\u0e1a\u0e35\u0e1a\u0e2d\u0e31\u0e14\u0e2b\u0e25\u0e31\u0e07\u0e08\u0e32\u0e01\u0e2b\u0e21\u0e38\u0e19\u0e04\u0e23\u0e31\u0e49\u0e07\u0e16\u0e31\u0e14\u0e44\u0e1b<\/td><\/tr><tr><td><code>missingok<\/code><\/td><td>\u0e44\u0e21\u0e48\u0e21\u0e35\u0e44\u0e1f\u0e25\u0e4c\u0e01\u0e47\u0e44\u0e21\u0e48\u0e41\u0e08\u0e49\u0e07 Error<\/td><\/tr><tr><td><code>notifempty<\/code><\/td><td>\u0e44\u0e21\u0e48\u0e2b\u0e21\u0e38\u0e19\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e27\u0e48\u0e32\u0e07<\/td><\/tr><tr><td><code>postrotate<\/code><\/td><td>\u0e41\u0e08\u0e49\u0e07\u0e43\u0e2b\u0e49 rsyslog \u0e40\u0e1b\u0e34\u0e14\u0e44\u0e1f\u0e25\u0e4c Log \u0e43\u0e2b\u0e21\u0e48<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e17\u0e14\u0e2a\u0e2d\u0e1a\u0e01\u0e32\u0e23\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32<\/h4>\n\n\n\n<p>\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32\u0e44\u0e1f\u0e25\u0e4c\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nlogrotate -d \/etc\/logrotate.conf\n<\/pre><\/div>\n\n\n<p>\u0e2b\u0e32\u0e01\u0e44\u0e21\u0e48\u0e21\u0e35 Error \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e1a\u0e31\u0e07\u0e04\u0e31\u0e1a\u0e43\u0e2b\u0e49\u0e2b\u0e21\u0e38\u0e19 Log \u0e44\u0e14\u0e49\u0e14\u0e49\u0e27\u0e22\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nlogrotate -f \/etc\/logrotate.conf\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c<\/h4>\n\n\n\n<p>\u0e14\u0e39\u0e44\u0e1f\u0e25\u0e4c Log \u0e17\u0e35\u0e48\u0e21\u0e35\u0e2d\u0e22\u0e39\u0e48<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nls -lh \/var\/log\/messages*\n<\/pre><\/div>\n\n\n<p>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n-rw------- 1 root root 2.0M Jul  3 00:19 \/var\/log\/messages\n-rw------- 1 root root 29M Jul  2 23:50 \/var\/log\/messages-20260703.gz\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e25\u0e1a\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e40\u0e01\u0e48\u0e32\u0e01\u0e27\u0e48\u0e32 30 \u0e27\u0e31\u0e19\u0e17\u0e31\u0e19\u0e17\u0e35 (\u0e16\u0e49\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23)<\/h4>\n\n\n\n<p>\u0e2b\u0e32\u0e01\u0e21\u0e35\u0e44\u0e1f\u0e25\u0e4c\u0e40\u0e01\u0e48\u0e32\u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e25\u0e1a\u0e17\u0e31\u0e19\u0e17\u0e35 \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nfind \/var\/log -name &quot;messages*&quot; -mtime +30 -delete\n<\/pre><\/div>\n\n\n<p>\u0e2b\u0e23\u0e37\u0e2d\u0e14\u0e39\u0e23\u0e32\u0e22\u0e01\u0e32\u0e23\u0e01\u0e48\u0e2d\u0e19\u0e25\u0e1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nfind \/var\/log -name &quot;messages*&quot; -mtime +30 -ls\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e1e\u0e37\u0e49\u0e19\u0e17\u0e35\u0e48\u0e14\u0e34\u0e2a\u0e01\u0e4c\u0e2b\u0e25\u0e31\u0e07\u0e17\u0e33\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e30\u0e2d\u0e32\u0e14<\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ndf -h\n<\/pre><\/div>\n\n\n<p>\u0e2b\u0e23\u0e37\u0e2d<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ndf -h \/var\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">\u0e2a\u0e23\u0e38\u0e1b<\/h4>\n\n\n\n<p>\u0e01\u0e32\u0e23\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ndaily\nrotate 30\ncompress\n<\/pre><\/div>\n\n\n<p>\u0e08\u0e30\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e23\u0e30\u0e1a\u0e1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0e2b\u0e21\u0e38\u0e19 Log \u0e17\u0e38\u0e01\u0e27\u0e31\u0e19<\/li>\n\n\n\n<li>\u0e40\u0e01\u0e47\u0e1a Log \u0e22\u0e49\u0e2d\u0e19\u0e2b\u0e25\u0e31\u0e07\u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13 30 \u0e27\u0e31\u0e19<\/li>\n\n\n\n<li>\u0e1a\u0e35\u0e1a\u0e2d\u0e31\u0e14\u0e44\u0e1f\u0e25\u0e4c\u0e40\u0e01\u0e48\u0e32\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34<\/li>\n\n\n\n<li>\u0e25\u0e1a\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e40\u0e01\u0e48\u0e32\u0e01\u0e27\u0e48\u0e32 1 \u0e40\u0e14\u0e37\u0e2d\u0e19\u0e42\u0e14\u0e22\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34<\/li>\n\n\n\n<li>\u0e0a\u0e48\u0e27\u0e22\u0e1b\u0e49\u0e2d\u0e07\u0e01\u0e31\u0e19\u0e1b\u0e31\u0e0d\u0e2b\u0e32\u0e1e\u0e37\u0e49\u0e19\u0e17\u0e35\u0e48\u0e14\u0e34\u0e2a\u0e01\u0e4c\u0e40\u0e15\u0e47\u0e21\u0e43\u0e19\u0e2d\u0e19\u0e32\u0e04\u0e15<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u0e1b\u0e31\u0e0d\u0e2b\u0e32 \u0e23\u0e30\u0e1a\u0e1a Linux \u0e42\u0e14\u0e22\u0e40\u0e09\u0e1e\u0e32\u0e30\u0e40\u0e0b\u0e34\u0e23\u0e4c\u0e1f\u0e40\u0e27\u0e2d\u0e23\u0e4c\u0e17\u0e35\u0e48\u0e17\u0e33\u0e07\u0e32\u0e19\u0e15\u0e48\u0e2d\u0e40\u0e19\u0e37\u0e48\u0e2d\u0e07\u0e40\u0e1b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","footnotes":""},"categories":[105,9],"tags":[],"class_list":["post-499","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/comments?post=499"}],"version-history":[{"count":2,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/499\/revisions"}],"predecessor-version":[{"id":502,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/499\/revisions\/502"}],"wp:attachment":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/media?parent=499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/categories?post=499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/tags?post=499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}