{"id":3008,"date":"2025-09-30T22:15:41","date_gmt":"2025-09-30T13:15:41","guid":{"rendered":"https:\/\/blog.id774.net\/entry\/?p=3008"},"modified":"2025-10-27T00:34:53","modified_gmt":"2025-10-26T15:34:53","slug":"rsyslog-%e3%81%ae%e3%83%ad%e3%82%b0%e3%83%ad%e3%83%bc%e3%83%86%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%92-daily-%e3%81%ab%e5%a4%89%e6%9b%b4%e3%81%97%e3%81%9f","status":"publish","type":"post","link":"https:\/\/blog.id774.net\/entry\/2025\/09\/30\/3008\/","title":{"rendered":"rsyslog \u306e\u30ed\u30b0\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3092 daily \u306b\u5909\u66f4\u3057\u305f"},"content":{"rendered":"<p>\u524d\u56de\u306f <a href=\"https:\/\/blog.id774.net\/entry\/2025\/09\/29\/3005\/\">sudo \u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u5c65\u6b74\u3092 auth.log \u304b\u3089\u5206\u96e2\u3059\u308b<\/a>\u3053\u3068\u3092\u691c\u8a0e\u3057\u305f\u304c\u3001\u52b9\u679c\u304c\u5c11\u306a\u3044\u3053\u3068\u304b\u3089\u4e0d\u63a1\u7528\u3068\u3057\u305f\u3002 <a href=\"https:\/\/blog.id774.net\/entry\/2025\/08\/31\/2974\/\">Debian GNU\/Linux<\/a> \u306e\u904b\u7528\u306b\u304a\u3051\u308b\u30ed\u30b0\u7ba1\u7406\u306b\u304a\u3044\u3066\u306f\u3001\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u9593\u9694\u304c\u8abf\u67fb\u52b9\u7387\u3084\u5b89\u5b9a\u904b\u7528\u306b\u76f4\u7d50\u3059\u308b\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306e weekly \u3067\u306f\u9031\u672b\u306b\u5411\u3051\u3066\u30b5\u30a4\u30ba\u304c\u80a5\u5927\u5316\u3057\u3001\u95b2\u89a7\u3084\u691c\u7d22\u304c\u91cd\u304f\u306a\u308b\u3053\u3068\u304c\u3042\u3063\u305f\u3002\u305d\u3053\u3067\u3001rsyslog \u306e\u4e3b\u8981\u30ed\u30b0\u3092 <strong>daily<\/strong> \u306b\u5909\u66f4\u3057\u3001\u4fdd\u6301\u671f\u9593\u306f\u5f93\u524d\u304b\u3089\u306e\u30dd\u30ea\u30b7\u30fc\u306b\u5247\u308a <strong>3 \u30f6\u6708<\/strong>\uff08rotate 90\uff09\u306b\u7d71\u4e00\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002\u672c\u7a3f\u306f\u305d\u306e\u30e1\u30ea\u30c3\u30c8\u30fb\u30c7\u30e1\u30ea\u30c3\u30c8\u3001\u8a2d\u5b9a\u3092\u6574\u3048\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3001\u6240\u6709\u6a29\u3068\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u306e\u6ce8\u610f\u70b9\u3092\u307e\u3068\u3081\u305f\u3002<\/p>\n<hr>\n<h2>\u5909\u66f4\u306e\u80cc\u666f<\/h2>\n<ul>\n<li>weekly \u3067\u306f\u9031\u672b\u306b\u5de8\u5927\u5316\u3057\u3001\u8abf\u67fb\u304c\u91cd\u304f\u306a\u308b\u3002<\/li>\n<li>\u969c\u5bb3\u3084\u30a4\u30f3\u30b7\u30c7\u30f3\u30c8\u306e\u5207\u308a\u5206\u3051\u3067\u3001\u65e5\u6b21\u5358\u4f4d\u306e\u533a\u5207\u308a\u304c\u6b32\u3057\u3044\u3002<\/li>\n<li>\u30dd\u30ea\u30b7\u30fc\u4e0a\u3001\u30ed\u30b0\u306f 3 \u30f6\u6708\u4fdd\u6301\uff08daily \u3068 rotate 90 \u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u7d20\u76f4\uff09\u3002<\/li>\n<\/ul>\n<hr>\n<h2>daily \u306b\u3057\u305f\u30e1\u30ea\u30c3\u30c8\u3068\u30c7\u30e1\u30ea\u30c3\u30c8<\/h2>\n<h3>\u30e1\u30ea\u30c3\u30c8<\/h3>\n<ul>\n<li>\u65e5\u6b21\u3067\u533a\u5207\u3089\u308c\u308b\u305f\u3081\u5bfe\u8c61\u65e5\u306e\u7279\u5b9a\u304c\u901f\u304f\u3001\u89e3\u6790\u304c\u3057\u3084\u3059\u3044\u3002<\/li>\n<li>\u9031\u672b\u306b\u5de8\u5927\u30d5\u30a1\u30a4\u30eb\u5316\u3057\u306b\u304f\u304f\u3001grep \u7b49\u306e\u64cd\u4f5c\u304c\u8efd\u3044\u3002<\/li>\n<li>3 \u30f6\u6708\u4fdd\u6301\u30dd\u30ea\u30b7\u30fc\u306b\u305d\u306e\u307e\u307e\u9069\u5408\u3059\u308b\u3002<\/li>\n<\/ul>\n<h3>\u30c7\u30e1\u30ea\u30c3\u30c8<\/h3>\n<ul>\n<li>\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u5897\u3048\u308b\u3002\u4eca\u56de\u306e\u5bfe\u8c61 6 \u7a2e\u985e \u00d7 90 \u4e16\u4ee3 = <strong>540 \u30d5\u30a1\u30a4\u30eb<\/strong>\u3002<\/li>\n<li>\u9023\u756a\u5f62\u5f0f\u3060\u3068\u65e5\u4ed8\u304c\u76f4\u611f\u7684\u306b\u5206\u304b\u308a\u306b\u304f\u3044\u3002dateext \u3092\u4f7f\u3046\u304b\u306f\u904b\u7528\u30dd\u30ea\u30b7\u30fc\u6b21\u7b2c\u3002<\/li>\n<li>\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u56de\u6570\u306f\u5897\u3048\u308b\u304c\u3001\u5727\u7e2e\u5bfe\u8c61\u304c\u5c0f\u3055\u304f\u306a\u308b\u305f\u3081\u5b9f\u8ca0\u8377\u306f\u8efd\u5fae\u3002<\/li>\n<\/ul>\n<hr>\n<h2>3 \u30f6\u6708\u4fdd\u6301\uff08rotate 90\uff09\u306e\u8003\u5bdf<\/h2>\n<ul>\n<li>\u76e3\u67fb\u3084\u30a4\u30f3\u30b7\u30c7\u30f3\u30c8\u5bfe\u5fdc\u306b\u5fc5\u8981\u306a 90 \u65e5\u5206\u3092\u78ba\u5b9f\u306b\u4fdd\u6301\u3067\u304d\u308b\u3002<\/li>\n<li>\u3088\u308a\u9577\u671f\u306e\u5206\u6790\uff08\u534a\u5e74\u301c1 \u5e74\uff09\u306f\u5225\u306e\u30ed\u30b0\u57fa\u76e4\uff08\u4f8b: syslog \u30b5\u30fc\u30d0\u30fc\u3001ELK\u3001Loki \u306a\u3069\uff09\u3067\u5bfe\u5fdc\u3059\u308b\u306e\u304c\u73fe\u5b9f\u7684\u3002<\/li>\n<li>\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u65b9\u91dd\u306f\u8981\u6574\u7406\u3002\u5727\u7e2e\u6e08\u307f\u904e\u53bb\u30ed\u30b0\u306f\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306e\u5bfe\u8c61\u5916\u306b\u3059\u308b\u306a\u3069\u306e\u6700\u9069\u5316\u304c\u6709\u52b9\u3002<\/li>\n<\/ul>\n<h3>\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9<\/h3>\n<ul>\n<li>\u4e3b\u306a\u51e6\u7406\u306f\u30d5\u30a1\u30a4\u30eb\u306e\u30ea\u30cd\u30fc\u30e0\u3068\u53e4\u3044\u4e16\u4ee3\u306e\u5727\u7e2e\u3002<\/li>\n<li>daily \u306b\u3059\u308b\u3068\u9031\u6bd4\u3067\u56de\u6570\u306f\u5897\u3048\u308b\u304c\u3001\u5404\u30d5\u30a1\u30a4\u30eb\u304c\u5c0f\u3055\u304f\u306a\u308b\u305f\u3081 CPU\/I\/O \u306e\u5b9f\u8ca0\u8377\u306f\u5c0f\u3055\u3044\u3002<\/li>\n<li>\u30e2\u30c0\u30f3\u306a\u74b0\u5883\u3067\u306f\u5b9a\u5e38\u904b\u7528\u3078\u306e\u5f71\u97ff\u306f\u307b\u307c\u7121\u8996\u3067\u304d\u308b\u3002<\/li>\n<\/ul>\n<h3>\u5207\u308a\u66ff\u3048\u30bf\u30a4\u30df\u30f3\u30b0<\/h3>\n<ul>\n<li>systemd \u30bf\u30a4\u30de\u30fc\u3084 cron.daily \u306b\u4f9d\u5b58\u3002\u74b0\u5883\u4f8b\u3067\u306f <strong>\u6bce\u65e5 00:35 \u524d\u5f8c<\/strong>\u306b\u5b9f\u884c\u3002<\/li>\n<li>weekly \u306e\u5834\u5408\u306f\u9031 1 \u56de\u306e\u65e9\u671d\u306b\u5b9f\u884c\u3055\u308c\u308b\u8a2d\u5b9a\u304c\u4e00\u822c\u7684\u3002<\/li>\n<li>\u591c\u9593\u30d0\u30c3\u30c1\u3068\u91cd\u306a\u308b\u5834\u5408\u306f\u6642\u9593\u8abf\u6574\u3092\u691c\u8a0e\u3059\u308b\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u8a2d\u5b9a\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u8981\u70b9<\/h2>\n<p>\u8a2d\u5b9a\u5909\u66f4\u306b\u969b\u3057\u3066\u306f\u624b\u4f5c\u696d\u3067\u306e\u9069\u7528\u3092\u907f\u3051\u3001<a href=\"https:\/\/github.com\/id774\/scripts\/blob\/master\/installer\/setup_rsyslog_logrotate.sh\">\u51aa\u7b49\u6027\u306e\u3042\u308b\u30b9\u30af\u30ea\u30d7\u30c8<\/a>\u3092\u4f5c\u6210\u3057\u5168\u74b0\u5883\u306b\u4e00\u5f8b\u3067\u9069\u7528\u3059\u308b\u3053\u3068\u306b\u3057\u305f\u3002<\/p>\n<ul>\n<li>\/etc\/logrotate.d\/rsyslog \u306e\u30bf\u30d6\u3092 4 \u30b9\u30da\u30fc\u30b9\u306b\u7d71\u4e00\u3057\u3066\u304b\u3089\u7de8\u96c6\u3059\u308b\u3002<\/li>\n<li>\u5404\u30d6\u30ed\u30c3\u30af\u5185\u306b\u5fc5\u305a <strong>daily<\/strong> \u3068 <strong>rotate 90<\/strong> \u3092\u5165\u308c\u308b\uff08\u7121\u3051\u308c\u3070\u8ffd\u52a0\u3001\u3042\u308c\u3070\u6b63\u898f\u5316\uff09\u3002<\/li>\n<li>\u30d6\u30ed\u30c3\u30af\u958b\u59cb\u306f\u884c\u672b\u306e\u6ce2\u62ec\u5f27\u306b\u3082\u5bfe\u5fdc\u3059\u308b\u3002<\/li>\n<li>\u6700\u5f8c\u306b\u6240\u6709\u6a29\u3068\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u3092 <strong>root:adm 640<\/strong> \u306b\u5f37\u5236\u3002<\/li>\n<li>\u5b9f\u884c\u5f8c\u306b\u30d5\u30a1\u30a4\u30eb\u306e\u6700\u7d42\u5185\u5bb9\u3092\u8868\u793a\u3057\u3066\u4eba\u9593\u304c\u78ba\u8a8d\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/li>\n<\/ul>\n<h3>\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u306e\u6ce8\u610f\u70b9<\/h3>\n<ul>\n<li>logrotate \u306f\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e <strong>\u30e6\u30fc\u30b6\u30fc\u6240\u6709\u8005\u304c root\uff08uid 0\uff09<\/strong>\u3067\u306a\u3044\u3068\u8aad\u307f\u8fbc\u307e\u306a\u3044\u3002<\/li>\n<li>\u30b0\u30eb\u30fc\u30d7\u306f adm \u3067\u3082 root \u3067\u3082\u3088\u3044\u3002\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u306f 640 \u3067\u3082 644 \u3067\u3082\u3088\u3044\u3002<\/li>\n<li>\u6240\u6709\u8005\u304c root \u4ee5\u5916\u3060\u3068\u300cIgnoring rsyslog because the file owner is wrong\u300d\u3068\u306a\u308a\u30b9\u30ad\u30c3\u30d7\u3055\u308c\u308b\u3002<\/li>\n<\/ul>\n<h3>dateext \u306e\u63a1\u5426<\/h3>\n<ul>\n<li>\u30e1\u30ea\u30c3\u30c8: \u65e5\u4ed8\u3067\u63a2\u3057\u3084\u3059\u304f\u3001\u76e3\u67fb\u4e0a\u306e\u8ffd\u8de1\u304c\u5bb9\u6613\u3002<\/li>\n<li>\u30c7\u30e1\u30ea\u30c3\u30c8: \u65e2\u5b58\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u9023\u756a\u524d\u63d0\u306a\u3089\u4e92\u63db\u8abf\u6574\u304c\u5fc5\u8981\u3002\u6b20\u640d\u304c\u65e5\u4ed8\u3067\u76ee\u7acb\u3064\u3002<\/li>\n<li>\u4eba\u9593\u304c\u76f4\u63a5\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u3044\u304b\u3051\u308b\u904b\u7528\u306a\u3089\u63a1\u7528\u3092\u691c\u8a0e\u3002\u30c4\u30fc\u30eb\u4e2d\u5fc3\u306a\u3089\u9023\u756a\u306e\u307e\u307e\u3067\u3082\u3088\u3044\u3002<\/li>\n<\/ul>\n<h2>\u5f71\u97ff\u3057\u3046\u308b\u5468\u8fba\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8<\/h2>\n<ul>\n<li>fail2ban: auth.log \u306e\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u5f8c\u3082\u53c2\u7167\u30d1\u30b9\u306f\u5909\u308f\u3089\u306a\u3044\u304c\u3001\u30ed\u30fc\u30c6\u30fc\u30c8\u76f4\u5f8c\u306e\u518d\u30aa\u30fc\u30d7\u30f3\u306f logrotate \u306e postrotate \u30d5\u30c3\u30af\u306b\u4f9d\u5b58\u3002<\/li>\n<li>logwatch\/logcheck: \u65e5\u6b21\u30ec\u30dd\u30fc\u30c8\u306f daily \u3068\u306e\u76f8\u6027\u304c\u826f\u3044\u3002<\/li>\n<li>\u76e3\u67fb\u30fb\u76e3\u8996\u30c4\u30fc\u30eb: \u30ed\u30b0\u30b5\u30a4\u30ba\u3084\u66f4\u65b0\u6642\u523b\u76e3\u8996\u306e\u95be\u5024\u306f\u518d\u8abf\u6574\u304c\u5fc5\u8981\u306a\u5834\u5408\u304c\u3042\u308b\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8<\/h2>\n<ul>\n<li>\/etc\/logrotate.d\/rsyslog \u306e\u6240\u6709\u6a29\u304c root:adm\u3001\u30e2\u30fc\u30c9\u304c 640 \u306b\u306a\u3063\u3066\u3044\u308b\u3002<\/li>\n<li>logrotate \u306e\u30b9\u30c6\u30fc\u30bf\u30b9 (\/var\/lib\/logrotate\/status) \u3067\u6700\u65b0\u65e5\u4ed8\u304c\u8a18\u9332\u3055\u308c\u3066\u3044\u308b\u3002<\/li>\n<li>\u624b\u52d5\u306e\u5f37\u5236\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u610f\u56f3\u3069\u304a\u308a\u306b\u4e16\u4ee3\u304c\u9032\u3080\u3002<\/li>\n<li>postrotate \u306b rsyslog \u306e\u518d\u30aa\u30fc\u30d7\u30f3\u51e6\u7406\u304c\u66f8\u304b\u308c\u3066\u3044\u308b\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u307e\u3068\u3081<\/h2>\n<ul>\n<li>weekly \u306f\u9031\u672b\u80a5\u5927\u5316\u3067\u8abf\u67fb\u52b9\u7387\u304c\u843d\u3061\u3084\u3059\u3044\u3002daily + rotate 90 \u306f 3 \u30f6\u6708\u4fdd\u6301\u30dd\u30ea\u30b7\u30fc\u3068\u76f8\u6027\u304c\u826f\u3044\u3002<\/li>\n<li>\u30d5\u30a1\u30a4\u30eb\u6570\u306f\u5897\u3048\u308b\u304c\u3001\u30b7\u30b9\u30c6\u30e0\u8ca0\u8377\u306f\u5c0f\u3055\u304f\u3001\u5b9f\u904b\u7528\u4e0a\u306e\u30e1\u30ea\u30c3\u30c8\u304c\u5927\u304d\u3044\u3002<\/li>\n<li>\u6240\u6709\u6a29\u30c1\u30a7\u30c3\u30af\u306f\u843d\u3068\u3057\u7a74\u3002\u5fc5\u305a root \u6240\u6709\u306b\u305d\u308d\u3048\u308b\u3002<\/li>\n<\/ul>\n<p>\u540c\u69d8\u306e\u8981\u4ef6\u304c\u3042\u308b\u74b0\u5883\u3067\u306f\u3001daily \u5316\u3068\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u306e\u5fb9\u5e95\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066 dateext \u306e\u63a1\u5426\u691c\u8a0e\u3092\u30bb\u30c3\u30c8\u3067\u9032\u3081\u308b\u3068\u3088\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306f sudo \u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u5c65\u6b74\u3092 auth.log \u304b\u3089\u5206\u96e2\u3059\u308b\u3053\u3068\u3092\u691c\u8a0e\u3057\u305f\u304c\u3001\u52b9\u679c\u304c\u5c11\u306a\u3044\u3053\u3068\u304b\u3089\u4e0d\u63a1\u7528\u3068\u3057\u305f\u3002 Debian GNU\/Linux \u306e\u904b\u7528\u306b\u304a\u3051\u308b\u30ed\u30b0\u7ba1\u7406\u306b\u304a\u3044\u3066\u306f\u3001\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u9593\u9694\u304c\u8abf\u67fb\u52b9\u7387 &#8230; <a title=\"rsyslog \u306e\u30ed\u30b0\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3092 daily \u306b\u5909\u66f4\u3057\u305f\" class=\"read-more\" href=\"https:\/\/blog.id774.net\/entry\/2025\/09\/30\/3008\/\" aria-label=\"rsyslog \u306e\u30ed\u30b0\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3092 daily \u306b\u5909\u66f4\u3057\u305f \u306b\u3064\u3044\u3066\u3055\u3089\u306b\u8aad\u3080\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,14],"tags":[],"class_list":["post-3008","post","type-post","status-publish","format-standard","hentry","category-diary","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts\/3008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/comments?post=3008"}],"version-history":[{"count":0,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/posts\/3008\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/media?parent=3008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/categories?post=3008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.id774.net\/entry\/wp-json\/wp\/v2\/tags?post=3008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}