개요
Observability Pipelines의 Google Pub/Sub 목적지를 사용하여 로그를 Google Pub/Sub 메시징 시스템에 게시하면 로그를 다운스트림 서비스, 데이터 레이크 또는 사용자 지정 애플리케이션으로 전송할 수 있습니다.
이 목적지를 사용하는 경우
이 목적지를 사용할 수 있는 일반적인 시나리오는 다음과 같습니다.
- 분석 파이프라인: 로그를 Google BigQuery, 데이터 레이크 또는 사용자 지정 머신러닝 워크플로로 다운스트림 라우팅합니다.
- 이벤트 기반 처리: 로그를 Pub/Sub 주제에 게시하여 Google Cloud Functions, Cloud Run 함수 및 Dataflow 작업이 로그 데이터를 기반으로 실시간으로 작업을 수행할 수 있도록 합니다.
전제 조건
목적지를 구성하기 전에 다음이 필요합니다.
- Pub/Sub 구독: Pub/Sub 주제와 메시지를 소비할 구독을 하나 이상 생성하세요.
- 인증: 표준 Google Cloud 인증 방식을 설정하세요. 옵션은 다음과 같습니다.
- 서비스 계정 키(JSON 파일)
- 워크로드 ID(Google Kubernetes Engine (GKE))
- IAM 역할:
이벤트를 게시하려면 -
roles/pubsub.publisher가 필요합니다.
상태 검사에는 - roles/pubsub.viewer가 권장됩니다.
- 역할이 누락된 경우 Healthcheck endpoint forbidden 오류가 기록되고 Worker는 정상적으로 실행됩니다.
Worker용 서비스 계정 설정
Google Cloud의 서비스 계정은 애플리케이션이나 서비스에서만 사용하는 계정 유형입니다.
- 자체 ID와 자격 증명(JSON 키 파일)을 가지고 있습니다.
- 특정 리소스에 액세스할 수 있도록 IAM 역할을 할당하세요.
- 이 경우 Observability Pipelines Worker는 서비스 계정을 사용하여 사용자를 대신해 Pub/Sub에 인증하고 로그를 전송합니다.
서비스 계정을 사용하여 인증하려면 다음을 수행합니다.
- Google Cloud 콘솔에서 IAM & Admin > **Service Accounts**로 이동합니다.
- + Create service account를 클릭합니다.
- 이름을 입력하고 Create and continue를 클릭합니다.
- 다음 역할을 할당합니다.
- Pub/Sub Publisher
- Pub/Sub Viewer
- Done을 클릭합니다.
인증 방식
올바른 역할이 할당된 서비스 계정을 생성한 후 다음 인증 방식 중 하나를 설정하세요.
옵션 1: 워크로드 ID 방식(GKE용, 권장)
- 서비스 계정을 Kubernetes 서비스 계정(KSA)에 바인딩합니다.
- 해당 KSA가 서비스 계정의 권한을 사용할 수 있도록 허용합니다.
- GKE가 사용할 서비스 계정을 알 수 있도록 KSA에 주석을 추가합니다.
- 이후 인증은 GCP의 메타데이터 서버에서 이루어집니다.
옵션 2: GSA를 VM에 직접 연결(Google Compute Engine용)
Google Compute Engine(GCE) VM에서 Observability Pipelines Worker를 실행 중인 경우 이 인증 방식을 사용하세요.
- VM을 생성하거나 수정할 때 Identity and API access > Service account에서 Google 서비스 계정을 지정하세요.
옵션 3: GSA로 서비스 실행(Cloud Run 또는 Cloud Functions의 경우)
Worker를 Cloud Run 서비스 또는 Cloud Function으로 배포하는 경우 이 인증 방식을 사용하세요.
- Cloud Run 또는 Cloud Functions 배포 설정에서 Execution service account를 생성한 Google 서비스 계정으로 설정하세요.
옵션 4: JSON 키 방식(ID 바인딩이 없는 모든 환경)
- 새 서비스 계정을 열고 Keys > Add key > Create new key로 이동합니다.
- JSON 형식을 선택합니다.
- 다운로드한 JSON 파일을 안전한 위치에 저장합니다.
- Worker를 설치한 후 JSON 파일을
DD_OP_DATA_DIR/config/에 복사하거나 마운트합니다.
Pipelines UI에서 목적지를 설정할 때 Google Pub/Sub 목적지의 Credentials path 필드에 이 파일을 참조하세요.
설정
파이프라인을 설정할 때 Google Pub/Sub 목적지를 설정하세요. 파이프라인은 UI, API 또는 Terraform을 사용하여 설정할 수 있습니다. 이 섹션에서 설명하는 단계는 UI에서 설정합니다.
파이프라인 UI에서 Google Pub/Sub 목적지를 선택한 다음 단계를 따르세요.
- 목적지 프로젝트 이름을 입력합니다.
- Pub/Sub 주제가 있는 GCP 프로젝트입니다.
- 주제를 입력합니다.
- Encoding 드롭다운 메뉴에서 파이프라인 출력을 JSON 또는 Raw message 형식으로 인코딩할지 선택합니다.
- JSON: 로그가 JSON으로 구조화됩니다. 다운스트림 도구에 구조화된 데이터가 필요한 경우 권장합니다.
- Raw: 로그가 원시 문자열로 전송되며 원래 형식이 유지됩니다.
- 자격 증명 JSON 파일이 있는 경우 해당 파일의 경로를 입력합니다.
- 서비스 계정 JSON을 사용하는 경우
DD_OP_DATA_DIR/config/<your-service-account>.json 경로를 입력하세요. - 또는
GOOGLE_APPLICATION_CREDENTIALS 환경 변수를 설정하세요. - GKE에서 워크로드 ID를 사용하는 경우 자격 증명이 자동으로 관리됩니다.
선택적 설정
TLS 활성화
시크릿 관리의 경우 TLS 키 암호의 식별자만 입력하세요. 실제 값은 입력하지 마세요.
Toggle the switch to Enable TLS.
- If you are using Secrets Management, enter the identifier for the key pass. See Secret defaults for the default used if the field is left blank.
- Enter the following certificate and key files:
Server Certificate Path: The path to the certificate file that has been signed by your Certificate Authority (CA) root file in DER, PEM, or CRT (X.509).- (Optional)
CA Certificate Path: The path to the certificate file that is your Certificate Authority (CA) root file in DER, PEM, or CRT (X.509). - (Optional)
Private Key Path: The path to the .key private key file that belongs to your Server Certificate Path in DER, PEM, or CRT (PKCS #8) format. - Notes:
- The configuration data directory
/var/lib/observability-pipelines-worker/config/ is automatically appended to the file paths. See Advanced Worker Configurations for more information. - The file must be readable by the
observability-pipelines-worker group and user.
If you enter secret identifiers and then choose to use environment variables, the environment variable is the identifier entered and prepended with DD_OP_. For example, if you entered PASSWORD_1 for a password identifier, the environment variable for that password is DD_OP_PASSWORD_1.
버퍼링
Toggle the switch to enable Buffering Options. Enable a configurable buffer on your destination to ensure intermittent latency or an outage at the destination doesn’t create immediate backpressure, and allow events to continue to be ingested from your source. Disk buffers can also increase pipeline durability by writing data to disk, ensuring buffered data persists through a Worker restart. See Destination buffers for more information.
- If left unconfigured, your destination uses a memory buffer with a capacity of 500 events.
- To configure a buffer on your destination:
- Select the buffer type you want to set (Memory or Disk).
- Enter the buffer size and select the unit.
- Maximum memory buffer size is 128 GB.
- Maximum disk buffer size is 5 TB.
- Note: For Worker versions 2.20.x and older, the maximum disk buffer size is 500 GB.
- In the Behavior on full buffer dropdown menu, select whether you want to block events or drop new events when the buffer is full.
시크릿 기본값
These are the defaults used for secret identifiers and environment variables.
- (필요시) Google Pub/Sub 엔드포인트 URL 식별자:
- 기본적으로 Worker는 글로벌 엔드포인트
https://pubsub.googleapis.com으로 데이터를 전송합니다. - Pub/Sub 주제가 특정 리전 전용인 경우, Google Pub/Sub 대체 엔드포인트 URL을 리전 엔드포인트로 구성하세요. 자세한 내용은 Pub/Sub 엔드포인트 정보를 참조하세요. 구성된 엔드포인트 URL을 시크릿 관리자에 입력하세요.
- 기본 식별자는
DESTINATION_GCP_PUBSUB_ENDPOINT_URL입니다.
- Google Pub/Sub TLS 암호 식별자(TLS가 활성화된 경우):
- 기본 식별자는
DESTINATION_GCP_PUBSUB_KEY_PASS입니다.
선택적 대체 Pub/Sub 엔드포인트
By default the Worker sends data to the global endpoint: https://pubsub.googleapis.com.
If your Pub/Sub topic is region-specific, configure the Google Pub/Sub alternative endpoint URL with the regional endpoint. See About Pub/Sub endpoints for more information.
The default environment variable is DD_OP_DESTINATION_GCP_PUBSUB_ENDPOINT_URL.
TLS (when enabled)
- Google Pub/Sub TLS passphrase:
- The default environment variable is
DD_OP_DESTINATION_GCP_PUBSUB_KEY_PASS.
문제 해결
일반적인 문제 및 해결 방법은 다음과 같습니다.
- 상태 확인 금지됨
roles/pubsub.viewer IAM 역할을 확인하세요.
- 권한 거부됨
- 서비스 계정에
roles/pubsub.publisher가 있는지 확인하세요.
- 인증 오류
- 자격 증명 JSON 경로 또는 GKE Workload Identity 설정을 확인하세요.
- 삭제된 이벤트
pipelines.component_discarded_events_total 및 pipelines.buffer_discarded_events_total 메트릭을 확인하세요.- 문제를 해결하려면 필요에 따라 버퍼 크기를 늘리거나 잘못 구성된 필터를 수정하세요.
- 높은 지연 시간
- 버퍼 크기와 제한 시간을 줄이거나 Worker를 확장하세요.
- 로그가 도착하지 않음
- Google Pub/Sub 목적지 설정에서 주제 이름, 프로젝트 및 Pub/Sub 엔드포인트(글로벌 또는 리전)를 다시 확인하세요.
상태 메트릭
모든 목적지에서 내보내는 구성 요소 메트릭 및 목적지 버퍼 메트릭에 대해서는 Pipelines 사용량 메트릭 문서를 참조하세요. Google Pub/Sub 목적지 메트릭을 필터링하거나 그룹화하려면 태그 component_type:gcp_pubsub를 사용하세요.
이벤트 배치 처리
이벤트 배치는 다음 중 하나의 파라미터를 충족하면 플러시됩니다. 자세한 내용은 목적지 이벤트 배치 처리를 참조하세요.
| 최대 이벤트 | 최대 크기(MB) | 타임아웃(초) |
|---|
| 1,000 | 10 | 1 |