

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# OpenTelemetry Collector와 함께 OpenSearch Ingestion 파이프라인 사용
<a name="configure-client-otel"></a>

[OpenTelemetry Collector](https://opentelemetry.io/docs/collector/)를 사용하여 로그, 추적 및 지표를 OpenSearch Ingestion 파이프라인으로 수집할 수 있습니다. 단일 파이프라인을 사용하여 모든 로그, 추적 및 지표를 도메인 또는 컬렉션의 다른 인덱스에 수집할 수 있습니다. 파이프라인을 사용하여 로그, 추적 또는 지표만 개별적으로 수집할 수도 있습니다.

**Topics**
+ [사전 조건](#otel-prereqs)
+ [1단계: 파이프라인 역할 구성](#otel-pipeline-role)
+ [2단계: 파이프라인 생성](#create-otel-pipeline)
+ [교차 계정 연결](#x-account-connectivity)
+ [제한 사항](#otel-limitations)
+ [OpenTelemetry 소스에 권장되는 CloudWatch 경보](#otel-pipeline-metrics)

## 사전 조건
<a name="otel-prereqs"></a>

[OpenTelemetry 구성 파일을](https://opentelemetry.io/docs/collector/configuration/) 설정하는 동안 수집을 수행하려면 다음을 구성해야 합니다.
+ 수집 역할에는 파이프라인과 상호 작용할 수 있는 `osis:Ingest` 권한이 필요합니다. 자세한 내용은 [수집 역할을 참조하세요](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/pipeline-security-overview.html#pipeline-security-same-account).
+ 엔드포인트 값에는 파이프라인 엔드포인트가 포함되어야 합니다. 예: `https://pipeline-endpoint.us-east-1.osis.amazonaws.com.`
+ 서비스 값은 여야 합니다`osis`.
+ OTLP/HTTP Exporter의 압축 옵션은 파이프라인에서 선택한 소스의 압축 옵션과 일치해야 합니다.

```
extensions:
    sigv4auth:
        region: "region"
        service: "osis"

exporters:
    otlphttp:
        logs_endpoint: "https://pipeline-endpoint.us-east-1.osis.amazonaws.com/v1/logs"
        metrics_endpoint: "https://pipeline-endpoint.us-east-1.osis.amazonaws.com/v1/metrics"
        traces_endpoint: "https://pipeline-endpoint.us-east-1.osis.amazonaws.com/v1/traces"
        auth:
            authenticator: sigv4auth
        compression: none

service:
    extensions: [sigv4auth]
    pipelines:
        traces:
        receivers: [jaeger]
        exporters: [otlphttp]
```

## 1단계: 파이프라인 역할 구성
<a name="otel-pipeline-role"></a>

 OpenTelemetry 수집기 구성을 설정한 후 [ 파이프라인 구성에 사용할 파이프라인 역할을 설정합니다](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/pipeline-security-overview.html#pipeline-security-sink). 파이프라인 역할에 OTLP 소스에 필요한 특정 권한은 없으며 파이프라인에 OpenSearch 도메인 또는 컬렉션에 대한 액세스 권한을 부여할 수 있는 권한만 있습니다.

## 2단계: 파이프라인 생성
<a name="create-otel-pipeline"></a>

 그런 다음 OTLP를 소스로 지정하는 다음과 같이 OpenSearch Ingestion 파이프라인을 구성할 수 있습니다. OpenTelemetry 로그, 지표 및 추적을 개별 소스로 구성할 수도 있습니다.

OTLP 소스 파이프라인 구성:

```
version: 2
otlp-pipeline:
    source:
        otlp:
            logs_path: /otlp-pipeline/v1/logs
            traces_path: /otlp-pipeline/v1/traces
            metrics_path: /otlp-pipeline/v1/metrics
    sink:
        - opensearch:
            hosts: ["https://search-mydomain.region.es.amazonaws.com"]
            index: "ss4o_metrics-otel-%{yyyy.MM.dd}"
            index_type: custom
            aws:
                region: "region"
```

OpenTelemetry Logs 파이프라인 구성:

```
version: 2
otel-logs-pipeline:
  source:
    otel_logs_source:
        path: /otel-logs-pipeline/v1/logs
  sink:
    - opensearch:
        hosts: ["https://search-mydomain.region.es.amazonaws.com"]
        index: "ss4o_metrics-otel-%{yyyy.MM.dd}"
        index_type: custom
        aws:
            region: "region"
```

OpenTelemetry 지표 파이프라인 구성:

```
version: 2
otel-metrics-pipeline:
  source:
    otel_metrics_source:
        path: /otel-metrics-pipeline/v1/metrics
  sink:
    - opensearch:
        hosts: ["https://search-mydomain.region.es.amazonaws.com"]
        index: "ss4o_metrics-otel-%{yyyy.MM.dd}"
        index_type: custom
        aws:
            region: "region"
```

OpenTelemetry Traces 파이프라인 구성:

```
version: 2
otel-trace-pipeline:
  source:
    otel_trace_source:
        path: /otel-traces-pipeline/v1/traces
  sink:
    - opensearch:
        hosts: ["https://search-mydomain.region.es.amazonaws.com"]
        index: "ss4o_metrics-otel-%{yyyy.MM.dd}"
        index_type: custom
        aws:
            region: "region"
```

사전 구성된 블루프린트를 사용하여 이 파이프라인을 생성할 수 있습니다. 자세한 내용은 [블루프린트 작업](pipeline-blueprint.md) 단원을 참조하십시오.

## 교차 계정 연결
<a name="x-account-connectivity"></a>

 OpenTelemetry 소스가 있는 OpenSearch Ingestion 파이프라인에는 교차 계정 수집 기능이 있습니다. OpenTelemetry Amazon OpenSearch Ingestion을 사용하면 Virtual Private Cloud(VPC) AWS 계정 에서 별도의 VPC의 파이프라인 엔드포인트로 파이프라인을 공유할 수 있습니다. 자세한 내용은 [교차 계정 수집을 위한 OpenSearch Ingestion 파이프라인 구성](cross-account-pipelines.md) 단원을 참조하십시오.

## 제한 사항
<a name="otel-limitations"></a>

 OpenSearch Ingestion 파이프라인은 20mb를 초과하는 요청을 수신할 수 없습니다. 이 값은 `max_request_length` 옵션에서 사용자가 구성합니다. 이 옵션은 기본적으로 10mb입니다.

## OpenTelemetry 소스에 권장되는 CloudWatch 경보
<a name="otel-pipeline-metrics"></a>

 수집 파이프라인의 성능을 모니터링하려면 다음 CloudWatch 지표가 권장됩니다. 이러한 지표는 내보내기에서 처리된 데이터의 양, 스트림에서 처리된 이벤트의 양, 내보내기 및 스트림 이벤트 처리 오류, 대상에 쓴 문서 수를 식별하는 데 도움이 될 수 있습니다. 이러한 지표 중 하나가 지정된 시간 동안 지정된 값을 초과하면 작업을 수행하도록 CloudWatch 경보를 설정할 수 있습니다.

 OTLP 소스에 대한 CloudWatch 지표는 형식으로 지정됩니다`{pipeline-name}.otlp.{logs | traces | metrics}.{metric-name}`. 예를 들어 `otel-pipeline.otlp.metrics.requestTimeouts.count`입니다.

 개별 OpenTelemetry 소스를 사용하는 경우 지표는 형식으로 지정됩니다`{pipeline-name}.{source-name}.{metric-name}`. 예를 들어 `trace-pipeline.otel_trace_source.requestTimeouts.count`입니다.

세 OpenTelemetry 데이터 형식은 모두 동일한 지표를 가지지만 간결하게 설명하면 지표는 OTLP 소스 로그 형식 데이터에 대한 아래 표에만 나열됩니다.


| 지표 | 설명 | 
| --- |--- |
| otel-pipeline.BlockingBuffer.bufferUsage.value |  사용 중인 버퍼의 양을 나타냅니다.  | 
|  otel-pipeline.otlp.logs.requestTimeouts.count  |  시간 초과된 요청 수입니다.  | 
|  otel-pipeline.otlp.logs.requestsReceived.count  |  OpenTelemetry Collector에서 수신한 요청 수입니다.  | 
|  otel-pipeline.otlp.logs.badRequests.count  |  OpenTelemetry Collector에서 수신한 잘못된 형식의 요청 수입니다.  | 
|  otel-pipeline.otlp.logs.requestsTooLarge.count  |  OpenTelemetry Collector에서 수신한 최대 20mb보다 큰 요청 수입니다.  | 
|  otel-pipeline.otlp.logs.internalServerError.count  | The number of HTTP 500 errors received from the OpenTelemetry Collector. | 
|  otel-pipeline.opensearch.bulkBadRequestErrors.count  | Count of errors during bulk requests due to malformed request. | 
|  otel-pipeline.opensearch.bulkRequestLatency.avg  | Average latency for bulk write requests made to OpenSearch. | 
|  otel-pipeline.opensearch.bulkRequestNotFoundErrors.count  | Number of bulk requests that failed because the target data could not be found. | 
|  otel-pipeline.opensearch.bulkRequestNumberOfRetries.count  | Number of retries by OpenSearch Ingestion pipelines to write OpenSearch cluster. | 
|  otel-pipeline.opensearch.bulkRequestSizeBytes.sum  | Total size in bytes of all bulk requests made to OpenSearch. | 
|  otel-pipeline.opensearch.documentErrors.count  | Number of errors when sending documents to OpenSearch. The documents causing the errors witll be sent to DLQ. | 
|  otel-pipeline.opensearch.documentsSuccess.count  | Number of documents successfully written to an OpenSearch cluster or collection. | 
|  otel-pipeline.opensearch.documentsSuccessFirstAttempt.count  | Number of documents successfully indexed in OpenSearch on the first attempt. | 
|  `otel-pipeline.opensearch.documentsVersionConflictErrors.count`  | Count of errors due to version conflicts in documents during processing. | 
|  `otel-pipeline.opensearch.PipelineLatency.avg`  | Average latency of OpenSearch Ingestion pipeline to process the data by reading from the source to writing to the destination. | 
|  otel-pipeline.opensearch.PipelineLatency.max  | Maximum latency of OpenSearch Ingestion pipeline to process the data by reading from the source to writing the destination. | 
|  otel-pipeline.opensearch.recordsIn.count  | Count of records successfully ingested into OpenSearch. This metric is essential for tracking the volume of data being processed and stored. | 
|  otel-pipeline.opensearch.s3.dlqS3RecordsFailed.count  | Number of records that failed to write to DLQ. | 
|  otel-pipeline.opensearch.s3.dlqS3RecordsSuccess.count  | Number of records that are written to DLQ. | 
|  otel-pipeline.opensearch.s3.dlqS3RequestLatency.count  | Count of latency measurements for requests to the Amazon S3 dead-letter queue. | 
|  otel-pipeline.opensearch.s3.dlqS3RequestLatency.sum  | Total latency for all requests to the Amazon S3 dead-letter queue | 
|  otel-pipeline.opensearch.s3.dlqS3RequestSizeBytes.sum  | Total size in bytes of all requests made to the Amazon S3 dead-letter queue. | 
|  otel-pipeline.recordsProcessed.count  | Total number of records processed in the pipeline, a key metric for overal throughput. | 
|  `otel-pipeline.opensearch.bulkRequestInvalidInputErrors.count`  | Count of bulk request errors in OpenSearch due to invalid input, crucial for monitoring data quality and operational issues. | 