This feature isn't available in all regions. Refer to the data center and regional availability page to check if it's supported in your region and explore alternative solutions.
Before querying data with Lens, you need to set up connections to supported data sources. Lens provides both system connectors for accessing NRDB data and data connectors for connecting to external databases and other data sources.
Requirements
Before you set up data connectors, make sure you meet the following requirements.
Permissions
If you are an Organization Manager, you have capabilities to access all Lens features by default. If you're not an Organization Manager, the Authentication Domain Manager needs to grant you an organization-scoped custom role with the required Lens capabilities, using either of the following methods:
UI: Create a new organization-scoped custom role, or edit an existing one, to add the connector or materialized view capabilities from the Query Your Data section, as listed in the following tables.
Important
Some capabilities grant broader access than others. For example, Modify also grants create, update, delete, and query or refresh access. If you only want to grant a narrower capability, select that specific capability instead of Modify.
The following permission IDs control access to Lens connectors:
Capability
Permission ID
Description
Lens Connector > Read
nr_lens.read.catalogs
View connectors and their details
Lens Connector > Modify
nr_lens.read.catalogs
nr_lens.create.catalogs
nr_lens.update.catalogs
nr_lens.delete.catalogs
nr_lens.query.connector
View, create, edit, delete, and query connectors
Lens Connector > Other: Query Connectors
nr_lens.query.connector
Grants explicit query permission for connectors, without the broader access granted by Modify
The following permission IDs control access to materialized views:
Capability
Permission ID
Description
Lens Materialized Views > Read
nr_lens.read.materialized_views
View materialized views
Lens Materialized Views > Modify
nr_lens.read.materialized_views
nr_lens.create.materialized_views
nr_lens.update.materialized_views
nr_lens.refresh.materialized_views
nr_lens.delete.materialized_views
View, create, edit, refresh, and delete materialized views
Grants explicit refresh permission for materialized views, without the broader access granted by Modify
Database access requirements
If your external database restricts access by IP address, you must whitelist New Relic's IP addresses to allow Lens to connect and query your data. Find the list of IP addresses here to add to your database's allowlist.
System connectors
Lens provides three system connectors for accessing NRDB data. These connectors are available automatically and don't require any setup.
Connector
Description
Access level
Telemetry
Access telemetry data from NRDB, such as transactions, logs, and metrics.
Account level. You can only access data from accounts where you have permissions.
Entity
Access entity data from NRDB, including services, hosts, and applications.
Account level. You can only access data from accounts where you have permissions.
Materialized views
Access materialized view data stored in NRDB (results from queries joining multiple databases).
Organization level. All users with Lens access can query materialized views.
Data connectors
Data connectors connect Lens to external data sources like databases, data warehouses, and spreadsheets. To create, edit, or delete connectors, you need specific RBAC permissions.
Access control
Lens provides two ways to control who can query connectors:
RBAC permissions: Users with Lens connectors RBAC permissions can query all connectors in the organization.
Fine-grained access control: Users without broad RBAC permissions can still query specific connectors if granted fine-grained access to those connectors. You set this up when you create the connector, as part of the following procedure.
Select your connector type from the dropdown menu.
Enter the required connection information for your selected connector type.
To grant this connector access to users or groups who don't have RBAC permissions, configure fine-grained access control from the Access control section:
Select the Auth domain containing the users or groups.
Select the User or group.
Select the Lens Viewer role.
To add more users or groups, click Add and repeat the steps above.
Click Create.
After you create a connector:
To view the schema or delete the connector, select the menu from the connector row.
To update access control settings, select the connector, add or remove access grants, and save your changes.
To update the connector configuration, delete and recreate the connector with the new details.
Connector configurations
Select your connector type to view the required fields.
Connect to Google Sheets to query spreadsheet data directly from Lens.
Parameter
Description
Name
A unique name to identify this connector when writing queries. For example, gsheets or employee_data.
credential_key
The base64-encoded JSON key for your Google Cloud service account. This authenticates Lens with Google Sheets API. See Generate the service account credentials key for instructions.
sheet_id
The ID of your metadata Google Sheet that contains information about all the sheets you want to access through Lens. See Set up Google Sheets access for instructions.
Generate the service account credentials key
To authenticate Lens with Google Sheets, you need to create a Google Cloud service account and generate a JSON key.
Create a service account
To create a Google Cloud service account, follow the instructions in Create service accounts.
Set up permissions for key creation
To create keys for your service account, you need the appropriate permissions. For information on the required permissions, see Required permissions.
To use the JSON key in Lens, convert the entire contents of the JSON file to base64 encoding and save it in a text file.
Set up Google Sheets access
After you've generated the credentials key, configure access to your Google Sheets.
Share your sheets with the service account
To allow Lens to access your data, grant read permissions to the service account email address for each Google Sheet you want to connect.
Create a metadata sheet
To manage the sheets available to Lens, create a new Google Sheet with the following four columns:
Sheetname: The name of each sheet you want to access with Lens. All listed sheets must be accessible by the service account.
Sheetid: The unique identifier for each sheet. You can find this in the sheet URL: https://docs.google.com/spreadsheets/d/SHEET_ID/edit.
Owner: The owner of the sheet. Use Trino as the default value.
Notes: Any additional notes or descriptions for the sheet.
Share the metadata sheet
To allow Lens to read the metadata, grant read permission to your service account for the metadata sheet.
Copy the metadata sheet ID
To configure the connector, copy the sheet ID from the metadata sheet URL. The sheet ID appears in the URL as: https://docs.google.com/spreadsheets/d/SHEET_ID/edit.
Important
The Glue Data Catalog and the S3 bucket containing your Iceberg data must be in the same AWS region.
Connect to Apache Iceberg tables stored in AWS using Glue Data Catalog for metadata management.
Grant Lens access to your AWS resources
To connect Lens to your Iceberg tables:
Create an IAM policy
Create an IAM policy with the following permissions to allow Lens to read the Glue metadata and the data files in S3. Replace {REGION}, {ACCOUNT_ID}, {DATABASE_NAME}, and {S3_BUCKET_NAME} with your values. Note the policy name you enter, as you'll need it to attach this policy to the IAM role.
Create an IAM role and configure the trust relationship to allow the Lens service account to assume it. When setting up the role, use these values:
Trusted entity type: AWS account
Account ID: 017663287629 (New Relic's AWS account)
Require external ID: Enabled. AWS requires a value to complete role creation, so enter a temporary placeholder (for example, temp-id). You'll replace this with the external ID Lens generates in the next step.
Permissions policy: Search for the policy name you created in the previous step and select it.
The trust policy should match the following format. Replace <AUTO_GENERATED_EXTERNAL_ID_FROM_LENS_UI> with the same temporary placeholder you entered above — you'll update this value again with the real, Lens-generated external ID in a later step.
Connect to Amazon Redshift data warehouses to query your analytics data.
Parameter
Description
Sample value
Name
A unique name to identify this connector when writing queries.
AppDB
connection-url
The JDBC URL to connect to Redshift. Format: jdbc:redshift://[host]:[port]/[database].
jdbc:redshift://example.net:5439/database
username
Your Redshift database username.
root
password
The password for your Redshift user.
password
Connect to Google BigQuery to query your cloud data warehouse tables.
Parameter
Description
Sample value
Name
A unique name to identify this connector when writing queries.
bigquery_data
project_id
Your Google Cloud project ID.
my-gcp-project
credential_key
The base64-encoded JSON key for your Google Cloud service account. This authenticates Lens with BigQuery. Refer to Generate the service account credentials key for instructions.
<base64-encoded-json-key>
Generate the service account credentials key
To authenticate Lens with BigQuery, you need a Google Cloud service account with the correct BigQuery roles, and a JSON key for that account.
Create a service account
If you don't already have a service account, refer to Create service accounts to create one.
Grant BigQuery roles
Refer to Grant an IAM role to grant the service account both of these roles, as reading data and running queries are separate BigQuery permissions:
BigQuery Data Viewer (roles/bigquery.dataViewer): Lets the connector read table data and metadata. You can scope this to specific datasets instead of the whole project for tighter access.
BigQuery Job User (roles/bigquery.jobUser): Lets the connector run queries. Grant this at the project level, as job execution isn't a dataset-level permission in BigQuery.
To use the JSON key in Lens, convert the entire contents of the JSON file to base64 encoding:
bash
$
base64 -i your-key-file.json |tr-d'\n'
When you create the connector, copy the output into the credential_key field.
Connect to Prometheus to query your metrics data.
Parameter
Description
Sample value
Name
A unique name to identify this connector when writing queries.
MetricsDB
uri
The URL of your Prometheus server.
http://localhost:9090
username (optional)
Username for basic authentication if your Prometheus server requires it.
username
password (optional)
Password for basic authentication.
password
query_chunk_duration (optional)
The duration of each query chunk sent to Prometheus. Smaller chunks reduce memory usage but increase the number of requests.
1d
max_query_range (optional)
The maximum time range for queries. Lens divides this range into chunks based on query_chunk_duration.
21d
cache_ttl (optional)
How long to cache values from this data source before refreshing.
30s
Connect to MongoDB databases to query your document data.
Important
You can't read your connection URL after it's set because it contains sensitive information, such as your password.
Parameter
Description
Sample value
Name
A unique name to identify this connector when writing queries.
CustomerDB
connection-url
The MongoDB connection string. Format: mongodb://<user>:<pass>@<host>:<port>/. Both username and password must be URL encoded.
mongodb://user:pass@cluster.mongodb.net:27017/
For MongoDB Atlas users: The username and password you enter in Lens are your Database User credentials, not the credentials you use to log into the Atlas web UI.
URL encoding: Your username and password must be URL encoded.
Connect to Elasticsearch to query your search and analytics data.
Parameter
Description
Sample value
Name
A unique name to identify this connector when writing queries.
host
The hostname or IP address of your Elasticsearch server.
port
The port number for your Elasticsearch server.
security
The security method for authentication.
username
Your Elasticsearch username for authentication.
password
The password for your Elasticsearch user.
tls_enabled (optional)
Enable TLS for secure connections to your Elasticsearch server.
Connect to AWS CloudWatch to query your cloud monitoring data.
Important
The CloudWatch connector is region-specific. Create separate connectors for each AWS region you want to query.
Grant Lens access to CloudWatch
To connect Lens to your CloudWatch metrics:
Create an IAM policy
Create an IAM policy with the following permissions to allow Lens to read CloudWatch metrics from your AWS account. Note the policy name you enter, as you'll need it to attach this policy to the IAM role.
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":[
"cloudwatch:ListMetrics",
"cloudwatch:GetMetricData",
"cloudwatch:GetMetricStatistics",
"tag:GetResources"
],
"Resource":"*"
}
]
}
Create an IAM role with a trust relationship
Create an IAM role and configure the trust relationship to allow the Lens service account to assume it. When setting up the role, use these values:
Trusted entity type: AWS account
Account ID: 017663287629 (New Relic's AWS account)
Require external ID: Enabled. AWS requires a value to complete role creation, so enter a temporary placeholder (for example, temp-id). You'll replace this with the external ID Lens generates in the next step.
Permissions policy: Search for the policy name you created in the previous step and select it.
The trust policy should match the following format. Replace <AUTO_GENERATED_EXTERNAL_ID_FROM_LENS_UI> with the same temporary placeholder you entered above — you'll update this value again with the real, Lens-generated external ID in a later step.
After creating the role, open the role's summary page and copy the Role ARN. You'll need this ARN to create the connector in the next step.
Create the connector
Go to one.newrelic.com > Administration > Connectors, click Create a connector, select AWS CloudWatch, and enter the following details, using the Role ARN from the previous step:
Parameter
Description
Sample value
Name
A unique name to identify this connector when writing queries. The name must start with nrlens-.
nrlens-cloudwatch-metrics
aws_region
The AWS region where your CloudWatch data is stored.