• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

問題を作成する

NerdGraph チュートリアル: ログ データ パーティション ルールの管理

NerdGraphは、 api.newrelic.com/graphiql で、 データ・パーティション・ルール のログの作成、照会、管理にご利用いただけます。NerdGraphは、GraphQL形式のAPIエクスプローラーです。

データ・パーティション・ルール・スキーマ

利用可能なデータ・パーティション・ルール・フィールドは以下の通りです。

フィールド

説明

id

一意のデータ・パーティション・ルール識別子。

targetDataPartition

データパーティションの名前です。

description

このデータ・パーティション・ルールが何を表しているかの説明。

matchingCriteria

(非推奨) このデータ パーティション ルールの一致基準。 ルールが有効になると、この条件に一致するログが指定されたデータ パーティションにルーティングされます。このフィールドは推奨されておらず、データ パーティションを作成する際の柔軟性を高めるために、最終的にnrqlフィールドに置き換えられます。matchingCriteriaに解析できないnrqlフィールドの NRQL WHERE句でルールが指定されている場合、このフィールドは null になります。

nrql

NRQL WHERE句を使用して指定された、このデータ パーティション ルールの一致基準。 ルールが有効になると、この条件に一致するログが指定されたデータ パーティションにルーティングされます。

retentionPolicy

データ・パーティション・データのリテンション・ポリシーです。

createdAt

ルールが作成された日付と時間。

によって作成された

ルールを作成したユーザー。

updatedAt

ルールが最後に変更された日付と時間。

updatedBy

ルールを最後に更新したユーザー。

有効

このデータパーティションルールが有効であるかどうか。

削除

このデータ・パーティション・ルールが削除されたかどうか。データ・パーティション・ルールを削除しても、すでにルーティングされたログは削除されません。

データ・パーティション・ルールのクエリ例

このNerdGraph APIリクエスト例では、指定されたアカウントのすべてのデータ・パーティション・ルールを取得します。この例では、いくつかのフィールドのみをリクエストしています。

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

nrql where 句を使用してデータ パーティション ルールを作成する

この例では、新しいデータ・パーティション・ルールを作成します。ルールを作成する前に、 organizing data with partitions についてのドキュメントを確認してください。

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"でデータ パーティション ルールを更新します。更新できるフィールドはdescriptionnrql 、およびenabledです。それらはすべてオプションなので、更新したいものだけを使用する必要があります。

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"でデータ パーティション ルールを更新します。更新できるフィールドはdescriptionmatchingCriteria 、およびenabledです。それらはすべてオプションなので、更新したいものだけを使用する必要があります。

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株式会社。

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