You can use NerdGraph at api.newrelic.com/graphiql to create, query, and manage your data partition rules for logs. NerdGraph is our GraphQL-format API explorer.
Data partition rule schema
Available data partition rule fields include:
Fields | Description |
---|---|
| Unique data partition rule identifier. |
| The name of the data partition. |
| A description of what this data partition rule represents. |
| (deprecated) The matching criteria for this data partition rule. Once the rule is enabled, logs matching this criteria will be routed to the specified data partition.
This field has been deprecated and will eventually be replaced with the |
| The matching criteria for this data partition rule specified using a NRQL |
| The retention policy of the data partition data. |
| The date and time the rule was created. |
| The user who created the rule. |
| The date and time the rule was last changed. |
| The user who last updated the rule. |
| Whether or not this data partition rule is enabled. |
| Whether or not this data partition rule has been deleted. Deleting a data partition rule does not delete the already routed logs. |
Example query of 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.
{ actor { account(id: 123456) { logConfigurations { dataPartitionRules { id targetDataPartition description nrql matchingCriteria { attributeName matchingOperator matchingExpression } } } } }}
Create data partitions rules using a nrql where clause
This example creates a new data partition rule. Before creating the rule, be sure to review our documentation about 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 } }}
Create data partitions rules with matchingCriteria (deprecated)
This example creates a new data partition rule. Before creating the rule, be sure to review our documentation about organizing data with partitions. The matchingCriteria
field is deprecated in favor of nrql
and will eventually be removed.
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 } }}
Update data partitions rules with a nrql where clause
This example updates the data partition rule with the given id "123"
. The fields that can be updated are description
, nrql
, and enabled
. All of them are optional, so you only need to use the ones you want to update.
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 } }}
Update data partitions rules
This example updates the data partition rule with the given id "123"
. The fields that can be updated are description
, matchingCriteria
, and enabled
. All of them are optional, so you only 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 } }}
Delete data partitions rules
This example deletes a data partition rule. Deleting a data partition rule doesn't delete data that has already been partitioned. That data is retained for a given period of time defined by the retentionPolicy
field.
mutation { logConfigurationsDeleteDataPartitionRule(id: "1111", accountId: 123456) { errors { message type } }}