8.2. 로그 전달 사용자 정의 리소스 업데이트
OpenShift Container Platform Log Forward API는 기술 프리뷰에서 OpenShift Container Platform 4.6에서 일반적으로 사용 가능으로 승격되었습니다. GA 릴리스에는 ClusterLogging 사용자 정의 리소스(CR)를 변경하고 LogForwarding 사용자 정의 리소스(CR)를 ClusterLogForwarder CR로 교체해야 하는 몇 가지 개선 사항 및 향상된 사항이 포함되어 있습니다.
OpenShift Container Platform 4.6의 샘플 ClusterLogForwarder 인스턴스
apiVersion: logging.openshift.io/v1
kind: ClusterLogForwarder
metadata:
name: instance
namespace: openshift-logging
....
spec:
outputs:
- url: http://remote.elasticsearch.com:9200
name: elasticsearch
type: elasticsearch
- url: tls://fluentdserver.example.com:24224
name: fluentd
type: fluentdForward
secret:
name: fluentdserver
pipelines:
- inputRefs:
- infrastructure
- application
name: mylogs
outputRefs:
- elasticsearch
- inputRefs:
- audit
name: auditlogs
outputRefs:
- fluentd
- default
...
OpenShift Container Platform 4.5의 샘플 ClusterLogForwarder CR
apiVersion: logging.openshift.io/v1alpha1
kind: LogForwarding
metadata:
name: instance
namespace: openshift-logging
spec:
disableDefaultForwarding: true
outputs:
- name: elasticsearch
type: elasticsearch
endpoint: remote.elasticsearch.com:9200
- name: fluentd
type: forward
endpoint: fluentdserver.example.com:24224
secret:
name: fluentdserver
pipelines:
- inputSource: logs.infra
name: infra-logs
outputRefs:
- elasticearch
- inputSource: logs.app
name: app-logs
outputRefs:
- elasticearch
- inputSource: logs.audit
name: audit-logs
outputRefs:
- fluentd
다음 절차는 변경해야 하는 각 매개변수를 보여줍니다.
프로세스
4.5의 ClusterLogForwarder CR을 4.6용 ClusterLogForwarding CR로 업데이트하려면 다음과 같이 수정합니다.
ClusterLogging사용자 정의 리소스(CR)를 편집하여logforwardingtechpreview주석을 제거합니다.샘플
ClusterLoggingCRapiVersion: "logging.openshift.io/v1" kind: "ClusterLogging" metadata: annotations: clusterlogging.openshift.io/logforwardingtechpreview: enabled1 name: "instance" namespace: "openshift-logging" ....- 1
logforwardingtechpreview주석을 제거합니다.
ClusterLogForwarderCR을 내보내ClusterLogForwarder인스턴스의 YAML 파일을 생성합니다.$ oc get LogForwarding instance -n openshift-logging -o yaml| tee ClusterLogForwarder.yamlYAML 파일을 편집하여 다음과 같이 수정합니다.
OpenShift Container Platform 4.6의 샘플
ClusterLogForwarder인스턴스apiVersion: logging.openshift.io/v11 kind: ClusterLogForwarder2 metadata: name: instance namespace: openshift-logging .... spec:3 outputs: - url: http://remote.elasticsearch.com:92004 name: elasticsearch type: elasticsearch - url: tls://fluentdserver.example.com:24224 name: fluentd type: fluentdForward5 secret: name: fluentdserver pipelines: - inputRefs:6 - infrastructure - application name: mylogs outputRefs: - elasticsearch - inputRefs: - audit name: auditlogs outputRefs: - fluentd - default7 ...- 1
apiVersion을"logging.openshift.io/v1alpha1"에서"logging.openshift.io/v1"로 변경합니다.- 2
- 오브젝트 유형을
kind에서 변경합니다. "LogForwarding"~kind: "ClusterLogForwarder". - 3
disableDefaultForwarding: true매개변수를 제거합니다.- 4
- 출력 매개변수를
spec.outputs.endpoint에서spec.outputs.url로 변경합니다. 접두사가 없는 경우https://,tcp://등과 같은 접두사를 URL에 추가합니다. - 5
- Fluentd 출력의 경우
유형을forward에서fluentdForward로 변경합니다. - 6
- 파이프라인 변경:
-
spec.pipelines.inputSource를spec.pipelines.inputRefs로 변경 -
logs.infra를인프라로 변경 -
logs.app을애플리케이션으로 변경 -
logs.audit를감사로 변경
-
- 7
- 선택 사항:
기본파이프라인을 추가하여 내부 Elasticsearch 인스턴스로 로그를 보냅니다.기본출력을 구성할 필요는 없습니다.참고내부 OpenShift Container Platform Elasticsearch 인스턴스에만 로그를 전달하려면 Log Forwarding API를 구성하지 마십시오.
CR 오브젝트를 생성합니다.
$ oc create -f ClusterLogForwarder.yaml
Log Forwarding API의 새로운 기능에 대한 자세한 내용은 타사 시스템에 로그 전달을 참조하십시오.