NerdGraphは、 api.newrelic.com/graphiql で、 データ・パーティション・ルール のログの作成、照会、管理にご利用いただけます。NerdGraphは、GraphQL形式のAPIエクスプローラーです。
データ・パーティション・ルール・スキーマ
利用可能なデータ・パーティション・ルール・フィールドは以下の通りです。
フィールド | 説明 |
---|---|
id | 一意のデータ・パーティション・ルール識別子。 |
targetDataPartition | データパーティションの名前です。 |
説明 | このデータ・パーティション・ルールが何を表しているかの説明。 |
matchingCriteria | このデータパーティションルールのマッチング基準です。ルールが有効になると、この基準に一致するログは、指定されたデータパーティションにルーティングされます。 |
retentionPolicy | データ・パーティション・データのリテンション・ポリシーです。 |
createdAt | ルールが作成された日付と時間。 |
作成者 | ルールを作成したユーザー。 |
更新日時 | ルールが最後に変更された日付と時間。 |
更新日時 | ルールを最後に更新したユーザー。 |
enabled | このデータパーティションルールが有効であるかどうか。 |
削除 | このデータ・パーティション・ルールが削除されたかどうか。データ・パーティション・ルールを削除しても、すでにルーティングされたログは削除されません。 |
データ・パーティション・ルールのクエリ例
このNerdGraph APIリクエスト例では、指定されたアカウントのすべてのデータ・パーティション・ルールを取得します。この例では、いくつかのフィールドのみをリクエストしています。
{ actor { account(id: 123456) { logConfigurations { dataPartitionRules { id targetDataPartition description matchingCriteria { attributeName matchingOperator matchingExpression } } } } }}
データ・パーティション・ルールの作成
この例では、新しいデータ・パーティション・ルールを作成します。ルールを作成する前に、 organizing data with partitions についてのドキュメントを確認してください。
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 } }}
データ・パーティション・ルールの更新
この例では、指定されたIDを持つデータ・パーティション・ルールを更新します。 " 123"
。更新可能なフィールドは、 description
、 matchingCriteria
、 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 } }}