공부/리눅스 관련

Ubuntu에서 syslog의 UFW BLOCK 메시지를 비활성화하는 방법

inSaPPoRo 2024. 3. 5. 01:41

Ubuntu에서 UFW를 이용하면 사용하는데는 문제가 없습니다. 하지만 syslog 로그에 너무나도 많은 UFW BLOCK 로그가 기록됩니다. syslog로그를 확인을 보다 쉽게 하기 위해서 syslog에 UFW BLOCK로그를 기록하지 않도록 설정해 보겠습니다.

syslog 설정 파일수정

ubuntu@ubuntu:/$ sudo cat /etc/rsyslog.d/20-ufw.conf
# Log kernel generated UFW log messages to file
:msg,contains,"[UFW " /var/log/ufw.log

# Uncomment the following to stop logging anything that matches the last rule.
# Doing this will stop logging kernel generated UFW log messages to the file
# normally containing kern.* messages (eg, /var/log/kern.log)
#& stop
ubuntu@ubuntu:/$

conf파일 수정

/etc/rsyslog.d/20-ufw.conf의 가장 아래 있는 「#& stop」에서 #을 제거해주세요

ubuntu@ubuntu:/$ sudo vi /etc/rsyslog.d/20-ufw.conf

# #을 제거해줍니다.
& stop

20-ufw.conf 파일을 저장해줍니다.

rsyslog 재시작

syslog 서비스를 다시 시작하여 변경 사항을 적용합니다.

sudo service rsyslog restart
반응형