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

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

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

문제 신고

NerdGraph 자습서: 로그 데이터 파티션 규칙 관리

api.newrelic.com/graphiql에서 NerdGraph 를 사용하여 로그에 대한 데이터 파티션 규칙 을 생성, 쿼리 및 관리할 수 있습니다. NerdGraph는 GraphQL 형식 API 탐색기입니다.

데이터 파티션 규칙 스키마

사용 가능한 데이터 파티션 규칙 필드는 다음과 같습니다.

필드

설명

id

고유한 데이터 파티션 규칙 식별자입니다.

targetDataPartition

데이터 파티션의 이름입니다.

description

이 데이터 파티션 규칙이 나타내는 내용에 대한 설명입니다.

matchingCriteria

(더 이상 사용되지 않음) 이 데이터 파티션 규칙에 대한 일치 기준입니다. 규칙이 활성화되면 이 기준과 일치하는 로그가 지정된 데이터 파티션으로 라우팅됩니다. 이 필드는 더 이상 사용되지 않으며 데이터 파티션을 생성할 때 더 많은 유연성을 허용하기 위해 결국 nrql 필드로 대체됩니다. 규칙이 matchingCriteria 로 구문 분석할 수 없는 nrql 필드의 NRQL WHERE 절로 지정된 경우 이 필드는 null이 됩니다.

nrql

NRQL WHERE 절을 사용하여 지정된 이 데이터 파티션 규칙에 대한 일치 기준입니다. 규칙이 활성화되면 이 기준과 일치하는 로그가 지정된 데이터 파티션으로 라우팅됩니다.

retentionPolicy

데이터 파티션 데이터의 보존 정책입니다.

createdAt

규칙이 생성된 날짜 및 시간입니다.

createdBy

규칙을 만든 사용자입니다.

updatedAt

규칙이 마지막으로 변경된 날짜 및 시간입니다.

updatedBy

규칙을 마지막으로 업데이트한 사용자입니다.

enabled

이 데이터 파티션 규칙이 활성화되었는지 여부.

deleted

이 데이터 파티션 규칙이 삭제되었는지 여부. 데이터 파티션 규칙을 삭제해도 이미 라우팅된 로그는 삭제되지 않습니다.

데이터 파티션 규칙의 쿼리 예

이 NerdGraph API 요청 예제는 주어진 계정에 대한 모든 데이터 파티션 규칙을 가져옵니다. 이 예에서는 몇 개의 필드만 요청합니다.

{
actor {
account(id: 123456) {
logConfigurations {
dataPartitionRules {
id
targetDataPartition
description
nrql
matchingCriteria {
attributeName
matchingOperator
matchingExpression
}
}
}
}
}
}

nrql where 절을 사용하여 데이터 파티션 규칙 작성

이 예에서는 새 데이터 파티션 규칙을 생성합니다. 규칙을 만들기 전에 파티션으로 데이터를 구성하는 방법 에 대한 설명서를 검토하세요.

mutation {
logConfigurationsCreateDataPartitionRule(
accountId: 1123456
rule: {
targetDataPartition: "Log_aNewDataPartitionRule"
description: "Example data partition rule"
nrql: "attrbute = 'value'"
retentionPolicy: STANDARD
enabled: true
}
) {
rule {
id
targetDataPartition
description
}
errors {
message
type
}
}
}

matchingCriteria(더 이상 사용되지 않음)를 사용하여 데이터 파티션 규칙 생성

이 예에서는 새 데이터 파티션 규칙을 생성합니다. 규칙을 만들기 전에 파티션으로 데이터 구성에 대한 설명서를 검토하십시오. matchingCriteria 필드는 nrql 위해 더 이상 사용되지 않으며 결국 제거될 예정입니다.

mutation {
logConfigurationsCreateDataPartitionRule(
accountId: 1123456
rule: {
targetDataPartition: "Log_aNewDataPartitionRule"
description: "Example data partition rule"
matchingCriteria: {
attributeName: "attribute"
matchingMethod: LIKE
matchingExpression: "'%example%'"
}
retentionPolicy: STANDARD
enabled: true
}
) {
rule {
id
targetDataPartition
description
}
errors {
message
type
}
}
}

nrql where 절로 데이터 파티션 규칙 업데이트

이 예는 지정된 ID가 "123" 인 데이터 파티션 규칙을 업데이트합니다. 업데이트할 수 있는 필드는 description , nrqlenabled 입니다. 모두 선택 사항이므로 업데이트하려는 항목만 사용하면 됩니다.

mutation {
logConfigurationsUpdateDataPartitionRule(
accountId: 1123456
rule: {
id: "123"
description: "Example data partition rule"
nrql: "attribute LIKE '%example%'"
enabled: true
}
) {
rule {
id
targetDataPartition
description
}
errors {
message
type
}
}
}

데이터 파티션 규칙 업데이트

이 예는 지정된 ID가 "123" 인 데이터 파티션 규칙을 업데이트합니다. 업데이트할 수 있는 필드는 description , matchingCriteriaenabled 입니다. 모두 선택 사항이므로 업데이트하려는 항목만 사용하면 됩니다.

mutation {
logConfigurationsUpdateDataPartitionRule(
accountId: 1123456
rule: {
id: "123"
description: "Example data partition rule"
matchingCriteria: {
attributeName: "attribute"
matchingMethod: LIKE
matchingExpression: "'%example%'"
}
enabled: true
}
) {
rule {
id
targetDataPartition
description
}
errors {
message
type
}
}
}

데이터 파티션 규칙 삭제

이 예는 데이터 파티션 규칙을 삭제합니다. 데이터 파티션 규칙을 삭제해도 이미 파티션된 데이터는 삭제되지 않습니다. 해당 데이터는 retentionPolicy 필드에 정의된 지정된 기간 동안 유지됩니다.

mutation {
logConfigurationsDeleteDataPartitionRule(id: "1111", accountId: 123456) {
errors {
message
type
}
}
}
Copyright © 2024 New Relic Inc.

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