Skip to content

Commit

Permalink
feat: add new data partition rules mutation on nerdgraph
Browse files Browse the repository at this point in the history
also remove the opt-in message since the feature is already open to anyone
  • Loading branch information
danybmx committed Sep 17, 2021
1 parent bb9ecc5 commit f1d0269
Showing 1 changed file with 37 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@ tags:
- NerdGraph
- Examples
- Logs
metaDescription: Create and manage data partition rules with NerdGraph.
metaDescription: Create and manage data partition rules with NerdGraph.
---

You can use New Relic’s [NerdGraph GraphQL explorer](https://api.newrelic.com/graphiql) to query and manage your [data partition rules](/docs/logs/log-management/ui-data/data-partitions/).
You can use New Relic’s [NerdGraph GraphQL explorer](https://api.newrelic.com/graphiql) to query and manage your [data partition rules](/docs/logs/log-management/ui-data/data-partitions/).

This document includes:

* Example partition rules queries
* How to create a data partition rule
* How to delete a data partition rule

<Callout variant="important">
Managing data partitions through NerdGraph is an opt-in feature. If you're interested in having this feature enabled for your account, please [contact customer support](https://support.newrelic.com).
</Callout>
* How to update a data partition rule
* How to delete a data partition rule

## How to query data partitions rules


This NerdGraph API request example gets all of the data partition rules for a given account. In this example, only a few fields are requested.

```
Expand All @@ -45,9 +41,10 @@ This NerdGraph API request example gets all of the data partition rules for a gi
}
}
```

## Data partition rule schema

Here's the complete list of possible data partition rule fields:
Here's the complete list of possible data partition rule fields:

<table>
<thead>
Expand Down Expand Up @@ -146,6 +143,37 @@ mutation {
}
```

## How to update data partitions rules

This example updates the data partition rule with given id `"123"`. The fields that could be updated are `description`, `matchingCriteria` and `enabled` and all of them are optional so you just need to use the ones you want to update.

```
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
}
}
}
```

## How to delete data partitions rules

This example deletes a data partition rule. Deleting a data partition rule doesn't delete the already persisted data. This data will be retained for a given period of time defined by the retention policy field.
Expand Down

0 comments on commit f1d0269

Please sign in to comment.