| Crates.io | nrql |
| lib.rs | nrql |
| version | 0.1.0 |
| created_at | 2025-12-07 17:01:17.876316+00 |
| updated_at | 2025-12-07 17:01:17.876316+00 |
| description | A CLI for executing NRQL queries against New Relic |
| homepage | |
| repository | https://github.com/caiges/nrql |
| max_upload_size | |
| id | 1971909 |
| size | 58,058 |
A CLI for executing NRQL queries against New Relic.
cargo install nrql
Or build from source:
cargo build --release
# Binary will be at target/release/nrql
# Set credentials via environment variables
export NEW_RELIC_API_KEY="your-api-key"
export NEW_RELIC_ACCOUNT_ID="your-account-id"
# Query any data type
nrql "SELECT * FROM Transaction SINCE 1 hour ago LIMIT 10"
nrql "SELECT * FROM Log WHERE level = 'ERROR' SINCE 30 minutes ago"
nrql "SELECT count(*) FROM Metric FACET metricName SINCE 1 day ago"
nrql "SELECT average(duration) FROM Transaction FACET name SINCE 1 week ago"
# Different output formats
nrql "SELECT * FROM Log LIMIT 5" -o table # Default: formatted table
nrql "SELECT * FROM Log LIMIT 5" -o text # Key-value pairs, one record at a time
nrql "SELECT * FROM Log LIMIT 5" -o json # JSON output
nrql "SELECT * FROM Log LIMIT 5" -o csv # CSV output
| Option | Short | Environment Variable | Description |
|---|---|---|---|
--api-key |
-k |
NEW_RELIC_API_KEY |
New Relic API key |
--account-id |
-a |
NEW_RELIC_ACCOUNT_ID |
New Relic account ID |
--output |
-o |
Output format: table, text, json, csv |
# Application performance
nrql "SELECT average(duration), count(*) FROM Transaction FACET name SINCE 1 hour ago"
# Error analysis
nrql "SELECT * FROM TransactionError SINCE 1 day ago LIMIT 100"
# Infrastructure metrics
nrql "SELECT average(cpuPercent) FROM SystemSample FACET hostname SINCE 1 hour ago"
# Log analysis
nrql "FROM Log SELECT * WHERE level = 'ERROR' SINCE 30 minutes ago"
# Custom events
nrql "SELECT * FROM MyCustomEvent SINCE 1 week ago"
# Export to file
nrql "SELECT * FROM Transaction SINCE 1 day ago" -o csv > transactions.csv
NRQL can query any data in your New Relic account:
Transaction - APM transaction dataTransactionError - Application errorsLog - Log dataMetric - Dimensional metricsSystemSample - Infrastructure host metricsProcessSample - Process-level metricsNetworkSample - Network metricsContainerSample - Container metricsK8sContainerSample - Kubernetes container data