본문 바로가기
WIKI 기술 지식 베이스

Handling pipeline failures

원문 보기 위키 갱신

출처: 문서

본문

파이프라인 실패 처리

1.0에서 도입됨 {: .label .label-purple }

각 수집 파이프라인은 문서에 순차적으로 적용되는 일련의 프로세서로 구성되어 있어요. 프로세서가 실패하면 전체 파이프라인이 실패해요. 실패를 처리하는 두 가지 옵션이 있어요:

  • 전체 파이프라인 실패: 프로세서가 실패하면 전체 파이프라인이 실패하고 문서가 인덱싱되지 않아요.
  • 현재 프로세서 실패 및 다음 프로세서로 계속: 프로세서 중 하나가 실패해도 문서 처리를 계속하려는 경우 유용해요.

기본적으로 수집 파이프라인은 프로세서 중 하나가 실패하면 중단돼요. 프로세서가 실패해도 파이프라인이 계속 실행되도록 하려면 파이프라인 생성 시 해당 프로세서의 ignore_failure 매개변수를 true로 설정하면 돼요:

PUT _ingest/pipeline/my-pipeline/
{
  "description": "Rename 'provider' field to 'cloud.provider'",
  "processors": [
    {
      "rename": {
        "field": "provider",
        "target_field": "cloud.provider",
        "ignore_failure": true
      }
    }
  ]
}

{% include copy-curl.html %}

프로세서가 실패한 직후 실행될 on_failure 매개변수를 지정할 수 있어요. on_failure를 지정하면 on_failure 구성이 비어 있어도 OpenSearch는 파이프라인의 다른 프로세서를 실행해요:

PUT _ingest/pipeline/my-pipeline/
{
  "description": "Add timestamp to the document",
  "processors": [
    {
      "date": {
        "field": "timestamp_field",
        "formats": ["yyyy-MM-dd HH:mm:ss"],
        "target_field": "@timestamp",
        "on_failure": [
          {
            "set": {
              "field": "ingest_error",
              "value": "failed"
            }
          }
        ]
      }
    }
  ]
}

{% include copy-curl.html %}

프로세서가 실패하면 OpenSearch는 실패를 기록하고 검색 파이프라인의 나머지 모든 프로세서를 계속 실행해요. 실패가 있었는지 확인하려면 수집 파이프라인 메트릭을 사용할 수 있어요. {: tip}

수집 파이프라인 메트릭

수집 파이프라인 메트릭을 보려면 Nodes Stats API를 사용하세요:

GET /_nodes/stats/ingest?filter_path=nodes.*.ingest

{% include copy-curl.html %}

응답에는 모든 수집 파이프라인의 통계가 포함되어 있어요. 예를 들면:

 {
  "nodes": {
    "iFPgpdjPQ-uzTdyPLwQVnQ": {
      "ingest": {
        "total": {
          "count": 28,
          "time_in_millis": 82,
          "current": 0,
          "failed": 9
        },
        "pipelines": {
          "user-behavior": {
            "count": 5,
            "time_in_millis": 0,
            "current": 0,
            "failed": 0,
            "processors": [
              {
                "append": {
                  "type": "append",
                  "stats": {
                    "count": 5,
                    "time_in_millis": 0,
                    "current": 0,
                    "failed": 0
                  }
                }
              }
            ]
          },
           "remove_ip": {
            "count": 5,
            "time_in_millis": 9,
            "current": 0,
            "failed": 2,
            "processors": [
              {
                "remove": {
                  "type": "remove",
                  "stats": {
                    "count": 5,
                    "time_in_millis": 8,
                    "current": 0,
                    "failed": 2
                  }
                }
              }
            ]
          }
        }
      }
    }
  }
}

수집 파이프라인 실패 문제 해결: 가장 먼저 해야 할 일은 로그를 확인하여 실패 원인을 파악하는 데 도움이 되는 오류나 경고가 있는지 확인하는 거예요. OpenSearch 로그에는 실패한 프로세서와 실패 이유를 포함하여 실패한 수집 파이프라인에 대한 정보가 포함되어 있어요. {: .tip}

더 알아보기 (Learn more)