Syslog 시스템 로그 관리
syslogd는 시스템의 여러 부분에서 발생하는 이벤트 및 메시지를 중앙 위치로 전송하고 저장합니다.
이를 통해 로그 메시지를 효율적으로 관리하고 모니터링을 할 수 있습니다.
시스템로그를 기록하는 syslog 설정을 통하여 시스템의 상태를 모니터링하고 문제를 식별하는 데 사용할 수 있습니다.
Syslog 기본설정(/etc/syslog.conf)
# Log all kernel messages to the console. # Logging much else clutters up the screen. #kern.* /dev/console # Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;authpriv.none;cron.none /var/log/messages #### info 레벨 이상의 모든 메시지를 대상으로 하되, mail, authpriv, cron에서 발생한 메시지는 제외 # The authpriv file has restricted access. authpriv.* /var/log/secure # Log all the mail messages in one place. mail.* /var/log/maillog # Log cron stuff cron.* /var/log/cron # Everybody gets emergency messages *.emerg * # Save news errors of level crit and higher in a special file. uucp,news.crit /var/log/spooler # Save boot messages also to boot.log local7.* /var/log/boot.log |
로그 facility 및 레벨 설정
어떤 종류의 로그 메시지를 기록할지 결정할 수 있습니다.
1) facility auth, authpriv cron daemon kern lpr syslog local0 ~ local7 2) 로그레벨 debug info notice warning err crit alert emerg |
syslogd 재시작
설정을 변경한 후에는 syslogd를 재시작하여 변경사항을 적용합니다.
sudo service syslog restart # Ubuntu, Debian
sudo systemctl restart syslog # CentOS, RHEL
출력로그 확인
설정된 로그 파일에서 로그를 확인할 수 있습니다.
sudo cat /var/log/messages
rsyslog를 통한 리모트 로깅 설정 가능(/etc/rsyslog.conf)
리모트 로그 메시지를 받기 위해 UDP 프로토콜을 사용하도록 설정할 수 있습니다.
$ModLoad imudp $UDPServerRun 514 |
또한, 위 각 로그들을 logrotate 설정하여 효율적으로 관리할 수 있습니다.
'Endpoint' 카테고리의 다른 글
[PowerCLI]VM Template 통한 VM머신 다수 배포 (0) | 2024.07.24 |
---|---|
[Windows]VMWare PowerCLI 모듈 설치 및 설정 : 효율적인 가상화 관리 (0) | 2024.07.23 |
VMWare OVF 추출 (0) | 2023.03.22 |
[Ubuntu] 고정 IP부여 + 실수썰 (0) | 2020.09.23 |
웹서비스 구축 (0) | 2020.08.23 |