• /
  • EnglishEspañolFrançais日本語한국어Português
  • 로그인지금 시작하기

사용자의 편의를 위해 제공되는 기계 번역입니다.

영문본과 번역본이 일치하지 않는 경우 영문본이 우선합니다. 보다 자세한 내용은 이 페이지를 방문하시기 바랍니다.

문제 신고

필터 프로세서

필터 프로세서는 OTTL(OpenTelemetry Transformation Language) 부울 표현식을 기반으로 텔레메트리 레코드 또는 특정 속성을 삭제합니다. 네트워크에서 나가기 전에 테스트 데이터, 디버그 로그, 상태 점검 또는 중요도가 낮은 모든 텔레메트리를 제거하는 데 사용하십시오.

필터 프로세서를 사용해야 하는 경우

다음과 같은 경우에 필터 프로세서를 사용하십시오.

  • 개인 식별 정보(PII) 또는 테스트 환경 데이터 삭제: 네트워크 외부로 유출되어서는 안 되는 데이터를 제거하세요.
  • 프로덕션 환경에서 디버그 수준 로그를 제거합니다. 심각도별로 필터링하여 불필요한 로그를 줄입니다.
  • 상태 점검 requests필터링: 반복적이고 가치가 낮은 모니터링 트래픽을 차단합니다.
  • 특정 접두사 또는 패턴이 있는 드래그를 제거 합니다. 불필요한 드래그 스트림을 제거합니다.
  • 속성에 따라 낮은 가치의 텔레메트리 제거: 서비스 이름, 환경 또는 사용자 정의 태그로 필터링

필터 프로세서 작동 방식

필터 프로세서는 각 텔레메트리 레코드에 대해 OTTL 부울 표현식을 평가합니다. 조건이 true 으로 평가되면 해당 레코드는 삭제됩니다.

이는 WHERE status = 'ERROR' "오류 유지"를 의미하는 많은 쿼리 언어와는 정반대입니다. 필터 프로세서에서 status == 'ERROR' "오류 제거"를 의미합니다.

구성

파이프라인에 필터 프로세서를 추가하세요.

filter/Logs:
description: Apply drop rules and data processing for logs
config:
error_mode: ignore
rules:
- name: drop the log records
description: drop all records which has severity text INFO
conditions:
- log.severity_text == "INFO"

설정 필드:

  • rules: 순서대로 평가되는 필터링 규칙 어레이.

    • name: 규칙 식별자.
    • context: 평가할 데이터 유형입니다. 지원되는 값: log, span, span_event, metric, datapoint.
    • conditions: OTTL 불리언 표현식 목록입니다.

여러 조건: 조건에 여러 표현식을 제공하면 OR 논리로 평가됩니다. 조건 중 하나라도 충족되면 해당 기록은 삭제됩니다.

OTTL 부울 연산자

비교 연산자

  • == - -와 같음
  • != - 같지 않음
  • < - 미만
  • <= - 이하
  • > - 보다 큰
  • >= - -보다 크거나 같음

논리 연산자

  • and - 두 조건 모두 충족되어야 합니다
  • or - 두 조건 중 하나라도 충족되어야 합니다.
  • not - 조건을 부정합니다

패턴 매칭

  • IsMatch - 정규 표현식 패턴 매칭
rules:
- name: match-health-logs
conditions:
- 'IsMatch(body, ".*health.*") or IsMatch(attributes["http.url"], ".*\\/api\\/v1\\/health.*")'

완전한 예시

예시 1: 테스트 환경 데이터 삭제

테스트 및 개발 환경에서 모든 텔레메트리를 제거하십시오.

config:
rules:
- name: drop-test-environment
description: Drop logs from test environment
conditions:
- 'resource.attributes["environment"] == "test"'
context: log
- name: drop-dev-environment
description: Drop logs from dev environment
conditions:
- 'resource.attributes["environment"] == "dev"'
context: log

예시 2: 프로덕션 환경에서 디버그 로그 삭제

운영 환경에서는 의미 있는 로그 레벨만 유지하세요.

config:
rules:
- name: drop-debug-logs
description: Drop all DEBUG severity logs
conditions:
- 'severity_text == "DEBUG"'
context: log
- name: drop-low-severity-logs
description: Drop INFO and below severity logs
conditions:
- "severity_number < 9"
context: log

심각도 번호 참조:

  • 트레이스 = 1-4
  • 디버그 = 5-8
  • 정보 = 9-12
  • 경고 = 13-16세
  • 오류 = 17-20
  • 치명적 = 21-24세

예시 3: 상태 확인 기간 삭제

진단 가치가 없는 상태 점검 트래픽을 제거합니다.

config:
rules:
- name: drop-health-endpoint
description: Drop spans from /health endpoint
conditions:
- 'attributes["http.path"] == "/health"'
context: span
- name: drop-health-check-spans
description: Drop spans named health_check
conditions:
- 'name == "health_check"'
context: span

예시 4: 서비스 이름으로 드롭하기

특정 서비스 또는 서비스 패턴을 필터링합니다.

config:
rules:
- name: drop-legacy-api
description: Drop logs from legacy API v1 service
conditions:
- 'resource.attributes["service.name"] == "legacy-api-v1"'
context: log
- name: drop-canary-services
description: Drop logs from canary deployment services
conditions:
- 'IsMatch(resource.attributes["service.name"], ".*-canary")'
context: log

예시 5: 특정 접두사가 포함된 메트릭 삭제

불필요한 메트릭 스트림을 제거하세요:

config:
rules:
- name: drop-internal-metrics
description: Drop metrics with internal prefix
conditions:
- 'IsMatch(name, "^internal\\.")'
context: metric
- name: drop-debug-datapoints
description: Drop datapoints marked as debug type
conditions:
- 'attributes["metric.type"] == "debug"'
context: datapoint

예제 6: AND 연산자를 사용한 결합 조건

여러 조건이 모두 충족될 때만 삭제합니다.

config:
rules:
- name: drop-debug-logs-from-test
description: Drop DEBUG logs from background-worker service in test environment
conditions:
- 'severity_text == "DEBUG"'
- 'resource.attributes["service.name"] == "background-worker"'
- 'resource.attributes["environment"] == "test"'
context: log

예시 7: 오류는 남겨두고 나머지는 모두 버리세요

가치 있는 데이터만 남기도록 논리를 반전시키세요.

config:
rules:
- name: drop-non-error-logs
description: Drop everything below ERROR severity level
conditions:
- "severity_number < 17"
context: log

또는 NOT 논리를 사용하세요:

filter/Logs:
description: "Drop non-errors"
config:
error_mode: ignore
rules:
- name: drop-non-error-logs
description: Drop logs that are not ERROR or FATAL
conditions:
- 'not (severity_text == "ERROR" or severity_text == "FATAL")'
context: log

예제 8: 로그 본문에서의 패턴 매칭

특정 패턴이 포함된 로그를 삭제합니다.

config:
rules:
- name: drop-health-check-logs
description: Drop logs with health check in body
conditions:
- 'IsMatch(body, ".*health check.*")'
context: log

예제 9: 볼륨은 높지만 가치가 낮은 스팬 삭제

자주 나타나지만 가치가 거의 없는 스팬을 제거합니다.

config:
rules:
- name: drop-fast-cache-hits
description: Drop cache hit operations faster than 1ms
conditions:
- 'attributes["db.operation"] == "get"'
- 'end_time_unix_nano - start_time_unix_nano < 1000000'
- 'attributes["cache.hit"] == true'
context: span

예제 10: HTTP 상태에 따른 드롭

성공적인 requests 필터링하고 오류는 유지합니다.

config:
rules:
- name: drop-successful-requests
description: Drop HTTP requests with status code less than 400
conditions:
- 'attributes["http.status_code"] < 400'
context: span

예제 11: OR 연산자를 사용한 여러 조건

조건 중 하나라도 충족되면 드롭하세요:

config:
rules:
- name: drop-test-health-debug
description: Drop logs from test environment, health checks, or debug severity
conditions:
- 'resource.attributes["environment"] == "test"'
- 'IsMatch(body, ".*health.*")'
- 'severity_text == "DEBUG"'
context: log

데이터 삭제 vs 속성 삭제

필터 프로세서는 (위에서 보는 것처럼) 전체 레코드를 삭제하거나, 유지되는 레코드에서 특정 속성만 삭제할 수 있습니다.

레코드를 유지하면서 속성을 삭제하려면 필터 프로세서가 아닌 변환 프로세서의 delete_key() 함수를 사용해야 합니다. 필터 프로세서는 전체 레코드만 삭제합니다.

잘못된 접근 방식 (이 방법은 효과가 없습니다):

filter/Logs:
config:
rules:
- name: wrong-attribute-drop
description: Identify and drop logs containing specific sensitive attributes
conditions:
- 'delete attributes["sensitive_field"]' # Filter conditions must be boolean, not actions
context: log

올바른 접근 방식 (변환 프로세서를 사용하세요):

transform/Logs:
description: "Remove sensitive attribute"
config:
rules:
- name: remove-sensitive-field
description: "Redacts the 'sensitive_field' attribute from log records to ensure privacy compliance."
statements:
- 'delete_key(attributes, "sensitive_field")'
output:
- nrexporter/newrelic

성능 고려 사항

  • 순서가 중요합니다. 불필요한 데이터를 비용이 많이 드는 처리 전에 제거하려면 필터 프로세서를 파이프라인 초반에 배치하세요.
  • 결합 조건: 여러 필터 프로세서를 사용하는 대신 단일 표현식에서 and/or 논리를 사용하십시오.
  • 정규식 성능: IsMatch 은(는) 정확한 일치 검사보다 비용이 더 많이 듭니다. 가능한 경우 == 을(를) 사용하십시오.

효율적인 주문의 예:

steps:
# ... receive steps ...
# ... probabilistic sampler steps ...
filter/Logs:
description: Apply drop rules and data processing for logs
output:
- transform/Logs
config:
error_mode: ignore
rules:
- name: drop the log records
description: drop all records which has severity text INFO
conditions:
- log.severity_text == "INFO"
context: log
filter/Metrics:
description: Apply drop rules and data processing for metrics
output:
- transform/Metrics
config:
error_mode: ignore
rules:
- name: drop-internal-metrics
description: drop internal metric
conditions:
- IsMatch(name, "^internal\\.")
context: metric
- name: drop-debug-datapoints
description: drop-debug-datapoints
conditions:
- attributes["metric.type"] == "debug"
context: datapoint
filter/Traces:
description: Apply drop rules and data processing for traces
output:
- transform/Traces
config:
error_mode: ignore
rules:
- name: drop-health-endpoint
description: drop-health-endpoint
conditions:
- attributes["http.path"] == "/health"
context: span
- name: drop-debug-events
description: drop-debug-events
conditions:
- name == 'debug_event'
context: span_event
# ... transformer steps...

OTTL 부울 표현식 참조

OTTL 구문 전체 및 추가 연산자는 다음과 같습니다.

다음 단계

Copyright © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.