25.3. runlabels로 rsyslog 실행
rsyslogd 데몬의 컨테이너화된 버전을 실행하도록 rhel8/rsyslog 컨테이너 이미지가 생성됩니다. rsyslog 이미지에는 다음 runlabels가 포함되어 있습니다. install,run 및 uninstall 입니다. 다음 절차에서는 rsyslog 이미지를 설치, 실행 및 제거하는 단계를 수행합니다.
사전 요구 사항
-
container-tools모듈이 설치되어 있습니다.
절차
rsyslog이미지를 가져옵니다.podman pull registry.redhat.io/rhel8/rsyslog
# podman pull registry.redhat.io/rhel8/rsyslogCopy to Clipboard Copied! Toggle word wrap Toggle overflow rsyslog에 대한설치runlabel 표시 :podman container runlabel install --display rhel8/rsyslog
# podman container runlabel install --display rhel8/rsyslog command: podman run --rm --privileged -v /:/host -e HOST=/host -e IMAGE=registry.redhat.io/rhel8/rsyslog:latest -e NAME=rsyslog registry.redhat.io/rhel8/rsyslog:latest /bin/install.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow 이는 명령이 호스트에 대한 권한을 열고 컨테이너의
/host에 호스트 루트 파일 시스템을 마운트하며install.sh스크립트를 실행하는 것을 보여줍니다.rsyslog에 대한설치runlabel을 실행합니다 :Copy to Clipboard Copied! Toggle word wrap Toggle overflow 이렇게 하면
rsyslog이미지가 나중에 사용할 파일을 호스트 시스템에 생성합니다.rsyslog의runlabel을 표시합니다 :podman container runlabel run --display rhel8/rsyslog
# podman container runlabel run --display rhel8/rsyslog command: podman run -d --privileged --name rsyslog --net=host --pid=host -v /etc/pki/rsyslog:/etc/pki/rsyslog -v /etc/rsyslog.conf:/etc/rsyslog.conf -v /etc/sysconfig/rsyslog:/etc/sysconfig/rsyslog -v /etc/rsyslog.d:/etc/rsyslog.d -v /var/log:/var/log -v /var/lib/rsyslog:/var/lib/rsyslog -v /run:/run -v /etc/machine-id:/etc/machine-id -v /etc/localtime:/etc/localtime -e IMAGE=registry.redhat.io/rhel8/rsyslog:latest -e NAME=rsyslog --restart=always registry.redhat.io/rhel8/rsyslog:latest /bin/rsyslog.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow 이는 명령이 호스트에 대한 권한을 열고 rsyslog
d데몬을 실행하기 위해rsyslog컨테이너를 시작할 때 컨테이너 내부의 호스트에서 특정 파일 및 디렉터리를 마운트함을 나타냅니다.rsyslog에대해runlabel을 실행합니다 :podman container runlabel run rhel8/rsyslog
# podman container runlabel run rhel8/rsyslog command: podman run -d --privileged --name rsyslog --net=host --pid=host -v /etc/pki/rsyslog:/etc/pki/rsyslog -v /etc/rsyslog.conf:/etc/rsyslog.conf -v /etc/sysconfig/rsyslog:/etc/sysconfig/rsyslog -v /etc/rsyslog.d:/etc/rsyslog.d -v /var/log:/var/log -v /var/lib/rsyslog:/var/lib/rsyslog -v /run:/run -v /etc/machine-id:/etc/machine-id -v /etc/localtime:/etc/localtime -e IMAGE=registry.redhat.io/rhel8/rsyslog:latest -e NAME=rsyslog --restart=always registry.redhat.io/rhel8/rsyslog:latest /bin/rsyslog.sh 28a0d719ff179adcea81eb63cc90fcd09f1755d5edb121399068a4ea59bd0f53Copy to Clipboard Copied! Toggle word wrap Toggle overflow rsyslog컨테이너는 권한을 열고 호스트에서 필요한 사항을 마운트하며,rsyslogd 데몬을 백그라운드()에서 실행합니다.-drsyslogd데몬은 로그 메시지 수집 및/var/log디렉토리의 파일에 메시지를 보냅니다.rsyslog에 대한제거runlabel을 표시 :podman container runlabel uninstall --display rhel8/rsyslog
# podman container runlabel uninstall --display rhel8/rsyslog command: podman run --rm --privileged -v /:/host -e HOST=/host -e IMAGE=registry.redhat.io/rhel8/rsyslog:latest -e NAME=rsyslog registry.redhat.io/rhel8/rsyslog:latest /bin/uninstall.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow rsyslog에 대한제거runlabel을 실행합니다 :podman container runlabel uninstall rhel8/rsyslog
# podman container runlabel uninstall rhel8/rsyslog command: podman run --rm --privileged -v /:/host -e HOST=/host -e IMAGE=registry.redhat.io/rhel8/rsyslog:latest -e NAME=rsyslog registry.redhat.io/rhel8/rsyslog:latest /bin/uninstall.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow
이 경우 uninstall.sh 스크립트는 /etc/logrotate.d/syslog 파일을 제거합니다. 구성 파일을 정리하지 않습니다.