다음을 통해 공유


UNIX 및 Linux 로그 파일 관리

 

적용 대상: System Center 2012 R2 Operations Manager, System Center 2012 - Operations Manager

UNIX 및 Linux용 Operations Manager 에이전트는 에이전트 로그 파일의 크기를 제한하지 않습니다.로그 파일의 최대 크기를 제어하려면 로그 파일을 관리하는 프로세스를 구현합니다.예를 들어 표준 유틸리티 logrotate은 대부분의 UNIX 및 Linux 운영 체제에서 사용할 수 있습니다.Logrotate 유틸리티는 UNIX 또는 Linux용 Operations Manager 에이전트에서 사용되는 로그 파일을 제어하도록 구성할 수 있습니다.에이전트의 로그 파일을 회전 또는 수정한 후에는 로깅을 다시 시작하기 위해 로그가 회전되었음을 에이전트에 신호로 알려야 합니다.다음 구문을 사용하여 scxadmin 명령을 –log-rotate 매개 변수와 함께 사용할 수 있습니다.

scxadmin –log-rotate all

Logrotate 구성 파일 예제

다음 예제에서는 Linux logrotate 유틸리티를 사용하여 scx.log 파일과 omiserver.log 파일을 회전하기 위한 구성 파일을 보여 줍니다.일반적으로 logrotate는 예약된 작업으로 실행되고(crond 사용) /etc/logrotate.d에 있는 구성 파일에 작동합니다.이 구성 파일을 테스트하고 사용하려면 환경에 적합하게 구성을 수정하고 /etc/logrotate.d에 파일을 연결하거나 저장합니다.

#opsmgr.lr

#Rotate scx.log

#Weekly rotation, retain 4 weeks of compressed logs

#Invoke scxadmin -log-rotate to resume logging after rotation

/var/opt/microsoft/scx/log/scx.log {

rotate 4

weekly

compress

missingok

notifempty

postrotate

/usr/sbin/scxadmin -log-rotate all

endscript

}#Rotate scx.log for the monitoring user account named: monuser

#Weekly rotation, retain 4 weeks of compressed logs

#Invoke scxadmin -log-rotate to resume logging after rotation

/var/opt/microsoft/scx/log/monuser/scx.log {

rotate 4

weekly

compress

missingok

notifempty

postrotate

/usr/sbin/scxadmin -log-rotate all

endscript

}

#Optionally, rotate omiserver.log.This requires that OMI be stopped and started to prevent

#impact to logging.Monthly rotation, retain 2 weeks of compressed logs

#Uncomment these lines if rotation of omiserver.log is needed

#/var/opt/microsoft/scx/log/omiserver.log{

# rotate 2

# monthly

# compress

# missingok

# notifempty

# prerotate

# /usr/sbin/scxadmin -stop

# endscript

# postrotate

# /usr/sbin/scxadmin -start

# endscript#}