9.4.8. Azure Monitor 로그에 전달
로깅 5.9 이상에서는 기본 로그 저장소에 추가하거나 대신 Azure Monitor Logs 로 로그를 전달할 수 있습니다. 이 기능은 Vector Azure Monitor Logs 싱크 에서 제공합니다.
사전 요구 사항
-
ClusterLogging사용자 정의 리소스(CR) 인스턴스를 관리하고 생성하는 방법을 잘 알고 있습니다. -
ClusterLogForwarderCR 인스턴스를 관리하고 생성하는 방법을 잘 알고 있습니다. -
ClusterLogForwarderCR 사양을 이해하고 있습니다. - Azure 서비스에 대한 기본적인 지식이 있습니다.
- Azure Portal 또는 Azure CLI 액세스용으로 구성된 Azure 계정이 있습니다.
- Azure Monitor 로그 기본 또는 보조 보안 키를 가져왔습니다.
- 전달할 로그 유형을 확인했습니다.
HTTP 데이터 수집기 API를 통해 Azure Monitor 로그에 대한 로그 전달을 활성화하려면 다음을 수행합니다.
공유 키를 사용하여 보안을 생성합니다.
apiVersion: v1
kind: Secret
metadata:
name: my-secret
namespace: openshift-logging
type: Opaque
data:
shared_key: <your_shared_key>
- 1
- 요청을 수행하는 Log Analytics 작업 공간에 대한 기본 또는 보조 키를 포함해야 합니다.
공유 키를 가져오려면 Azure CLI에서 다음 명령을 사용할 수 있습니다.
Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName "<resource_name>" -Name "<workspace_name>”
로그 선택과 일치하는 템플릿을 사용하여 ClusterLogForwarder CR을 생성하거나 편집합니다.
모든 로그를 전달
apiVersion: "logging.openshift.io/v1"
kind: "ClusterLogForwarder"
metadata:
name: instance
namespace: openshift-logging
spec:
outputs:
- name: azure-monitor
type: azureMonitor
azureMonitor:
customerId: my-customer-id
logType: my_log_type
secret:
name: my-secret
pipelines:
- name: app-pipeline
inputRefs:
- application
outputRefs:
- azure-monitor
- 1
- 로그 분석 작업 공간의 고유 식별자입니다. 필수 필드입니다.
- 2
- 제출 중인 데이터의 Azure 레코드 유형입니다. 문자, 숫자, 밑줄(_)만 포함할 수 있으며 100자를 초과할 수 없습니다.
애플리케이션 및 인프라 로그 전달
apiVersion: "logging.openshift.io/v1"
kind: "ClusterLogForwarder"
metadata:
name: instance
namespace: openshift-logging
spec:
outputs:
- name: azure-monitor-app
type: azureMonitor
azureMonitor:
customerId: my-customer-id
logType: application_log
secret:
name: my-secret
- name: azure-monitor-infra
type: azureMonitor
azureMonitor:
customerId: my-customer-id
logType: infra_log #
secret:
name: my-secret
pipelines:
- name: app-pipeline
inputRefs:
- application
outputRefs:
- azure-monitor-app
- name: infra-pipeline
inputRefs:
- infrastructure
outputRefs:
- azure-monitor-infra
- 1
- 제출 중인 데이터의 Azure 레코드 유형입니다. 문자, 숫자, 밑줄(_)만 포함할 수 있으며 100자를 초과할 수 없습니다.
고급 구성 옵션
apiVersion: "logging.openshift.io/v1"
kind: "ClusterLogForwarder"
metadata:
name: instance
namespace: openshift-logging
spec:
outputs:
- name: azure-monitor
type: azureMonitor
azureMonitor:
customerId: my-customer-id
logType: my_log_type
azureResourceId: "/subscriptions/111111111"
host: "ods.opinsights.azure.com"
secret:
name: my-secret
pipelines:
- name: app-pipeline
inputRefs:
- application
outputRefs:
- azure-monitor