---
title: NrAuditEvent: Query account audit logs
source: https://docs.newrelic.com/docs/accounts/accounts/account-maintenance/query-account-audit-logs-nrauditevent
---

As an additional security measure for using and managing New Relic, you can use the `NrAuditEvent` event to view audit logs that show changes in your New Relic organization.

## What is the `NrAuditEvent`? [#attributes]

The `NrAuditEvent` is created to record some important types of configuration changes you and your users make in your New Relic organization. Data gathered includes the type of account change, what actor made the change, a human-readable description of the action taken, and a timestamp for the change. Reported information includes:

-   Users added or deleted
-   User permission changes
-   Login and logout events
-   Account changes made via API
-   [Synthetic monitor changes](https://docs.newrelic.com/docs/synthetics/new-relic-synthetics/administration/audit-synthetics-account-changes)
-   Dashboard creation, deletion, updates, and [public sharing](https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/share-dashboards-publicly/#audit-trail-dashboard)
-   Workload configuration changes

User, permission, and login events are only written to the parent/reporting account ID of your New Relic organization.

To see all the attributes reported by this event, see [`NrAuditEvent`](/attribute-dictionary/?event=NrAuditEvent).

To be notified about these types of changes, you can use [alerts](https://docs.newrelic.com/docs/alerts/new-relic-alerts/getting-started/alerting-new-relic).

## Caveats and details on using `NrAuditEvent` [#retention]

All New Relic accounts can query up to 13 months of account changes.

If your New Relic organization and accounts were created using the [Partnership API](https://docs.newrelic.com/docs/new-relic-partnerships/partner-integration-guide/partner-account-maintenance/partner-api), `NrAuditEvent` won't return information about creating or editing accounts.

Audit logging is different than configuring [audit mode](https://docs.newrelic.com/docs/agents/manage-apm-agents/configuration/log-audit-all-data-your-new-relic-agent-transmits) for an APM agent. APM audit mode records information about all data being transmitted from your app.

## Example queries [#default-attributes]

Here are some examples of querying the `NrAuditEvent` using [NRQL](https://docs.newrelic.com/docs/insights/nrql-new-relic-query-language/nrql-resources/nrql-syntax-components-functions#sel-since).

### General account changes [#examples-any]

**What changes have been made to the New Relic account?**

To view all changes to your New Relic account for a specific time frame, run this basic NRQL query:

````sql
SELECT * 
FROM NrAuditEvent 
SINCE 1 day ago
```

````

**What type of account change was made the most?**

To query what type of change to the account users was made the most frequently during a specific time frame, include the [`actionIdentifier` attribute](#actorIdentifier) in your query. For example:

````sql
SELECT count(*) AS Actions 
FROM NrAuditEvent 
FACET actionIdentifier 
SINCE 1 week ago
```

````

**What accounts were added to our organization?**

To query for information about created accounts and who created them, you can use something like:

````sql
SELECT actorEmail, actorId, targetId 
FROM NrAuditEvent 
WHERE actionIdentifier = 'account.create' 
SINCE 1 month ago
```

````

**What users have logged into our organization?**

Login events are only written to the parent/reporting account ID of your New Relic organization. To query users who logged into your organization, use a query similar to the following:

````sql
SELECT actorEmail, actorId 
FROM NrAuditEvent 
WHERE actionIdentifier = 'user.login' 
SINCE 1 month ago
```

````

**What trends appear in account changes?**

When you include `TIMESERIES` in a NRQL query, the results are shown as a line graph. For example:

````sql
SELECT count(*) 
FROM NrAuditEvent 
TIMESERIES facet actionIdentifier since 1 week ago
```

````

**What user management changes have been done?**

Query the top-level account in your [New Relic organization](https://docs.newrelic.com/docs/accounts/accounts-billing/new-relic-one-pricing-users/new-relic-account-structure).

To see all the changes made to users, you could use:

````sql
SELECT * 
FROM NrAuditEvent 
WHERE targetType = 'user' 
SINCE this month
```

If you wanted to narrow that down to see changes to [user type](/docs/accounts/accounts-billing/new-relic-one-user-management/user-type), you could use:

```sql
SELECT * FROM NrAuditEvent 
WHERE targetType = 'user' 
  AND actionIdentifier IN ('user.self_upgrade', 'user.change_type') 
SINCE this month
```

````

**Synthetic monitoring: What changes have been made to a monitor?**

To query updates for your synthetic monitors during a specific time frame, include the [`actionIdentifier`](/attribute-dictionary/?event=NRAuditEvent/actionIdentifier) attribute in your query. For example:

````sql
SELECT count(*) FROM NrAuditEvent 
WHERE actionIdentifier = 'synthetics_monitor.update_script' 
FACET actionIdentifier, description, actorEmail 
SINCE 1 week ago LIMIT 1000
```

For more information about this synthetic monitoring feature, see [synthetic monitoring audit log](/docs/synthetics/new-relic-synthetics/administration/audit-synthetics-account-changes).

````

**Workloads: What changes were made to any workload configuration?**

To query what configuration changes were made to any workload, use the query below. The `targetId` attribute contains the GUID of the workload that was modified, which you can use for searches. Since changes on workloads are often automated, you might want to include the `actorType` attribute to know if the change was done directly by a user through the UI or through the API.

````sql
SELECT timestamp, actorEmail, actorType, description, targetId 
FROM NrAuditEvent 
WHERE targetType = 'workload' 
SINCE 1 week ago LIMIT MAX
```

````

**What target types are in my account?**

The `targetType` attribute describes the object that changed, such as account, role, user, alert conditions or notifications, and logs.
To generate a list of `targetType` values for your account, run the query below. Note that this query will only show `targetTypes` that have been touched.

````sql
SELECT uniques(targetType)
FROM NrAuditEvent
SINCE 90 days ago
```

````

### Changes made by specific users [#examples-who]

**What account changes have been made by any user?**

To see detailed information about any user who made changes to the account during a specific time frame, include [`actorType = 'user'`](#actorType) in the query. For example:

````sql
SELECT actionIdentifier, description, actorEmail, actorId, targetType, targetId 
FROM NrAuditEvent 
WHERE actorType = 'user' 
SINCE 1 week ago
```

````

**What account changes have been made by a specific user?**

To query account activities made by a specific person during the selected time frame, you must know their [`actorId`](#actorId). For example:

````sql
SELECT actionIdentifier 
FROM NrAuditEvent 
WHERE actorId = 829034 SINCE 1 week ago
```

````

**Who made the most changes to the account?**

To identify who ([`actorType`](#actorType)) has made the most changes to the account, include the [`actorEmail` attribute](#actorEmail) in your query. For example:

````sql
SELECT count(*) as Users 
FROM NrAuditEvent 
WHERE actorType = 'user' 
FACET actorEmail SINCE 1 week ago
```

````

**Synthetic monitoring: What monitors were created by a specific user?**

To query updates from your synthetic monitors made by a specific user, include the [`actionIdentifier`](/attribute-dictionary/?event=NRAuditEvent&attribute=actionIdentifier) and [`actorEmail`](/attribute-dictionary/?event=NRAuditEvent&attribute=actorEmail) attribute in your query. For example:

````sql
SELECT count(*) FROM NrAuditEvent 
WHERE actionIdentifier = 'synthetics_monitor.update_script' 
FACET actorEmail, actionIdentifier, description 
SINCE 1 week ago LIMIT 1000
```

````

### Changes made using the API [#examples-api]

**What account changes have been made using an API key?**

To see detailed information about changes to the account that were made using an API key during a specific time frame, include [`actorType = 'api_key'`](#actorType) in the query. For example:

````sql
SELECT actionIdentifier, description, targetType, targetId, actorAPIKey, actorId, actorEmail 
FROM NrAuditEvent 
WHERE actorType = 'api_key' 
SINCE 1 week ago
```

````
