![rsyslog conf 파일 구문 다중 필터](https://rvso.com/image/762152/rsyslog%20conf%20%ED%8C%8C%EC%9D%BC%20%EA%B5%AC%EB%AC%B8%20%EB%8B%A4%EC%A4%91%20%ED%95%84%ED%84%B0.png)
Red Hat 8 시스템에서 rsyslog를 설정하고 있습니다. 소스 IP를 기반으로 필터링하고 다음과 같이 특정 파일에 로그를 작성하는 첫 번째 부분이 작동하고 있습니다.
if $fromhost-ip startswith '10.1.2.45' then /var/log/test_all.log
& ~
내가 하고 싶은 것은 올바른 구문을 알아낼 수 없지만 다음을 확인하는 것입니다.호스트 IP그리고인증시설을 선택하고 파일에 씁니다.
위에 나열된 것보다 먼저 해당 명령문이 필요하다는 것을 알고 있지만 작동시킬 수는 없습니다. 나는 또한 (부팅 로그)를 시도했지만 local7
그것도 작동하지 않았습니다. 다음 두 가지 예는 제가 시도했지만 작동하지 않았던 구문입니다.
예시 1:
if $fromhost-ip startswith '10.1.2.45' and $syslogfacility-text == 'local7' then /var/log/test_boot.log
& stop
if $fromhost-ip startswith '10.1.2.45' and $syslogfacility-text == 'local10' then /var/log/test_secure.log
& stop
if $fromhost-ip startswith '10.1.2.45' then /var/log/test_all.log
& stop
예 2:
if $fromhost-ip startswith '10.1.2.45' and $syslogfacility-text == 'authpriv.*' then /var/log/test_secure.log
& stop
if $fromhost-ip startswith '10.1.2.45' then /var/log/test_all.log
& stop
답변1
여기에서 찾은 솔루션: rsyslog 구성 구문
if $fromhost-ip startswith '10.1.2.45' then {
authpriv.* -/var/log/test_secure.log
-/var/log/test_all.log
& stop
}