본문 바로가기
Linux/OpenShift

RHOCP) OpenShift Logging (4) - journald 설정 변경

by LILO 2023. 8. 5.
반응형

INTRO

Openshift Logging Operator를 설치 후 PV를 설정하게되면 아래와 같은 그림과 비슷한 구성이 됩니다.

RHOCP 운영시 Namespace가 많아질 경우 수집할 데이터도 많아지기 때문에  Fluentd가 데이터를 잘 수집하여도 로그가 일부 누락될 수도 있습니다.

Journald 설정 파일을 통해 일정 기간 유지할 로그  수, 압축 설정 등을 이용하여 로그를 삭제하지 않고 리소스 사용량도 줄이는 효과를 볼 수 있습니다.

https://www.redhat.com/en/resources/openshift-container-storage-overview

자세한 내용은 아래의 문서를 참고바랍니다.

 

Configuring systemd-journald for Logging - Configuring your Logging deployment | Logging | OpenShift Container Platform 4.13

As you scale up your project, the default logging environment might need some adjustments. For example, if you are missing logs, you might have to increase the rate limits for journald. You can adjust the number of messages to retain for a specified period

docs.openshift.com

 

 

Butane을 이용한 Journal MachineConfig 설정

Fluentd가 로그를 수집하는 속도보다 Journald 서비스가 시스템 로깅하는 속도가 더 빠르기 때문에 저널 항목이 일부 손실될 수도 있습니다.

이러한 현상을 막으려면 아래의 설정이 필수적으로 기입되어야합니다.

RateLimitIntervalSec(30초) 동안 쌓인 로그가  RateLimitBurst(10000개) 이상이면 30초의 interval 시간에 쌓인 모든 추가 로그는 삭제됩니다. RateLimitBurst의 값인 10000개는 예시이므로 리소스가 여유롭다면 높게 설정하는 것이 좋습니다.

파라미터 권장 값
RateLimitIntervalSec 30s 
RateLimitBurst 10000 (필요시 더 높게 설정하면 좋음)

 

Journal과 관련된 Butane 설정 파일을 작성합니다.

<Master node 제외 모든 node Journal 설정>
# cat << EOF > 40-worker-custom-journald.bu
variant: openshift
version: 4.13.0
metadata:
  name: 40-worker-custom-journald
  labels:
    machineconfiguration.openshift.io/role: "worker"
storage:
  files:
  - path: /etc/systemd/journald.conf
    mode: 0644
    overwrite: true
    contents:
      inline: |
        Compress=yes
        ForwardToConsole=no
        ForwardToSyslog=no
        MaxRetentionSec=1month
        RateLimitBurst=10000
        RateLimitIntervalSec=30s
        Storage=persistent
        SyncIntervalSec=1s
        SystemMaxUse=8G
        SystemKeepFree=20%
        SystemMaxFileSize=10M
EOF

# butane 40-worker-custom-journald.bu -o 40-worker-custom-journald.yaml

# oc apply -f  40-worker-custom-journald.yaml


<Master node Journal 설정 - 필요시 설정>
# cat << EOF > 40-master-custom-journald.bu

variant: openshift
version: 4.13.0
metadata:
  name: 40-worker-custom-journald
  labels:
    machineconfiguration.openshift.io/role: "master"
storage:
  files:
  - path: /etc/systemd/journald.conf
    mode: 0644
    overwrite: true
    contents:
      inline: |
        Compress=yes
        ForwardToConsole=no
        ForwardToSyslog=no
        MaxRetentionSec=1month
        RateLimitBurst=10000
        RateLimitIntervalSec=30s
        Storage=persistent
        SyncIntervalSec=1s
        SystemMaxUse=8G
        SystemKeepFree=20%
        SystemMaxFileSize=10M
EOF

# butane 40-master-custom-journald.bu -o 40-master-custom-journald.yaml

# oc apply -f  40-master-custom-journald.yaml

MachineConfig가 정상적으로 반영되면 MCP가 아래와 같이 UPDATED가 True 상태로 돌아옵니다.

# oc get mcp
NAME     CONFIG                                             UPDATED   UPDATING   DEGRADED   MACHINECOUNT   READYMACHINECOUNT   UPDATEDMACHINECOUNT   DEGRADEDMACHINECOUNT   AGE
infra    rendered-infra-bda765ed72f5edd7cde4b0d0ef9f0ae2    True      False      False      3              3                   3                     0                      6d19h
master   rendered-master-72cf2730054f6efbc9d5dc9b194271ec   True      False      False      3              3                   3                     0                      10d
worker   rendered-worker-bda765ed72f5edd7cde4b0d0ef9f0ae2   True      False      False      2              2                   2                     0                      10d

 

반응형