×ðÁú¿­Ê±

ÔõÑùÉèÖÃCentOSϵͳÒÔÏÞÖÆÓû§¶ÔϵͳÈÕÖ¾µÄÐÞ¸Ä

ÔõÑùÉèÖÃcentosϵͳÒÔÏÞÖÆÓû§¶ÔϵͳÈÕÖ¾µÄÐÞ¸Ä

ÔÚCentOSϵͳÖУ¬ÏµÍ³ÈÕÖ¾ÊǺÜÊÇÖ÷ÒªµÄÐÅÏ¢Ô´£¬Ëü¼Í¼ÁËϵͳµÄÔËÐÐ״̬¡¢¹ýʧÐÅÏ¢¡¢ÖÒÑԵȡ£ÎªÁ˱£»¤ÏµÍ³µÄÎȹÌÐÔºÍÇå¾²ÐÔ£¬ÎÒÃÇÓ¦¸ÃÏÞÖÆÓû§¶ÔϵͳÈÕÖ¾µÄÐ޸ġ£±¾ÎĽ«ÏÈÈÝÔõÑùÉèÖÃCentOSϵͳ£¬ÊµÏÖ¶ÔϵͳÈÕÖ¾µÄÐÞ¸ÄȨÏÞÏÞÖÆ¡£

Ò»¡¢½¨ÉèÓû§×éºÍÓû§

Ê×ÏÈ£¬ÎÒÃÇÐèÒª½¨ÉèÒ»¸öרÃÅÈÏÕæÖÎÀíϵͳÈÕÖ¾µÄÓû§×飬ÒÔ¼°Ò»¸öÓÃÓÚÖÎÀíÈÕÖ¾µÄͨË×Óû§¡£¼ÙÉèÎÒÃǽ¨ÉèµÄ×éÃûΪlogadmin£¬Óû§Îªloguser£¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´½¨É裺

sudo groupadd logadmin
sudo useradd -g logadmin loguser

µÇ¼ºó¸´ÖÆ

¶þ¡¢ÐÞËûÈÕÖ¾ÎļþµÄȨÏÞ

½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÐÞ¸ÄϵͳÈÕÖ¾ÎļþµÄȨÏÞ£¬Ê¹Ö»ÓÐlogadmin×éµÄÓû§²Å»ª¶ÔÆä¾ÙÐÐÐ޸ģ¬ÆäËûÓû§Ö»ÄܶÁÈ¡¡£Í¨³££¬CentOSϵͳµÄÈÕÖ¾ÎļþλÓÚ/var/logĿ¼Ï£¬ÒÔϵͳÈÕÖ¾Îļþ/var/log/messagesΪÀý£¬ÎÒÃÇ¿ÉÒÔÖ´ÐÐÒÔÏÂÏÂÁîÀ´ÐÞ¸ÄȨÏÞ£º

sudo chown root:logadmin /var/log/messages
sudo chmod 640 /var/log/messages

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÏÂÁÈÕÖ¾ÎļþµÄËùÓÐÕßÉèÖÃΪrootÓû§£¬ËùÊô×éÉèÖÃΪlogadmin×飬²¢½«È¨ÏÞÉèÖÃΪ640¡£ÕâÑùÒ»À´£¬Ö»ÓÐrootÓû§ÒÔ¼°ÊôÓÚlogadmin×éµÄÓû§²Å¿ÉÒÔ¶ÔÈÕÖ¾Îļþ¾ÙÐÐÐ޸ģ¬ÆäËûÓû§Ö»ÄܶÁÈ¡¡£

Èý¡¢ÉèÖÃsudoȨÏÞ

ΪÁËÈ·±£Ö»ÓÐlogadmin×éµÄÓû§²ÅÓÐȨÏÞÐÞËûÈÕÖ¾Îļþ£¬ÎÒÃÇ»¹ÐèҪͨ¹ýÉèÖÃsudoȨÏÞ£¬ÏÞÖÆÖ»ÓÐlogadmin×éµÄÓû§¿ÉÒÔʹÓÃÌض¨µÄÏÂÁî¡£¼ÙÉèÎÒÃÇÒªÏÞÖÆloguserÓû§Ö»ÄÜʹÓÃlogrotateÏÂÁÎÒÃÇ¿ÉÒÔÖ´ÐÐÒÔÏ°취£º

ʹÓÃvisudoÏÂÁî±à¼­sudoersÎļþ£º

sudo visudo

µÇ¼ºó¸´ÖÆ

ÔÚÎļþÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º

%logadmin ALL=(ALL) NOPASSWD: /usr/sbin/logrotate

µÇ¼ºó¸´ÖÆ

ÕâÑùÒ»À´£¬Ö»ÓÐÊôÓÚlogadmin×éµÄÓû§²Å»ªÊ¹ÓÃlogrotateÏÂÁ²¢ÇÒ²»ÐèÒªÊäÈëÃÜÂë¡£

ËÄ¡¢²âÊÔÉèÖÃ

Íê³ÉÒÔÉÏÉèÖúó£¬ÎÒÃÇ¿ÉÒÔ²âÊÔÊÇ·ñÀÖ³ÉÏÞÖÆÁËÓû§¶ÔϵͳÈÕÖ¾µÄÐÞ¸ÄȨÏÞ¡£

Çл»µ½loguserÓû§£º

sudo su - loguser

µÇ¼ºó¸´ÖÆ

ʵÑéÐÞËûÈÕÖ¾Îļþ£º

echo "test" >> /var/log/messages

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÓÉÓÚloguserÓû§²»ÊôÓÚlogadmin×飬Òò´ËÎÞ·¨ÐÞËûÈÕÖ¾Îļþ£¬½«»áÌáÐÑȨÏÞȱ·¦¡£

ʹÓÃlogadminÓû§ÊµÑéÐÞËûÈÕÖ¾Îļþ£º

echo "test" >> /var/log/messages

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÓÉÓÚlogadminÓû§ÊôÓÚlogadmin×飬Òò´Ë¾ßÓÐÐÞËûÈÕÖ¾ÎļþµÄȨÏÞ¡£

ͨ¹ýÒÔÉÏÉèÖã¬ÎÒÃÇÀÖ³ÉÏÞÖÆÁËÓû§¶ÔϵͳÈÕÖ¾µÄÐÞ¸ÄȨÏÞ£¬±£»¤ÁËϵͳµÄÎȹÌÐÔºÍÇå¾²ÐÔ¡£

×ܽá

±¾ÎÄÏÈÈÝÁËÔõÑùÉèÖÃCentOSϵͳ£¬ÏÞÖÆÓû§¶ÔϵͳÈÕÖ¾µÄÐÞ¸ÄȨÏÞ¡£Í¨¹ý½¨ÉèÓû§×éºÍÓû§¡¢ÐÞËûÈÕÖ¾ÎļþµÄȨÏÞÒÔ¼°ÉèÖÃsudoȨÏÞ£¬ÎÒÃÇ¿ÉÒÔʵÏÖÖ»ÓÐÌض¨Óû§Äܹ»ÐÞ¸ÄϵͳÈÕÖ¾£¬ÔöǿϵͳµÄÇå¾²ÐÔºÍÎȹÌÐÔ¡£

×¢ÖØ£º±¾ÎÄʾÀýÖÐʹÓõÄ×éÃû¡¢Óû§ÒÔ¼°ÈÕÖ¾ÎļþµÈ½ö¹©²Î¿¼£¬ÏÖʵʹÓÃʱӦƾ֤ÏÖÕæÏàÐξÙÐе÷½â¡£

ÒÔÉϾÍÊÇÔõÑùÉèÖÃCentOSϵͳÒÔÏÞÖÆÓû§¶ÔϵͳÈÕÖ¾µÄÐ޸ĵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Á¢³¡£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

13452372176

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿