1. The infrastructure agent #
Hosts and processes.
Overview #
The infrastructure agent (Linux, Windows, macOS, container) reports host state every 5 to 15 seconds: SystemSample (CPU, memory, load), StorageSample, NetworkSample, ProcessSample, plus inventory (packages, configuration).
docker run -d --name newrelic-infra --network=host --cap-add=SYS_PTRACE --privileged --pid=host \
-v "/:/host:ro" -v "/var/run/docker.sock:/var/run/docker.sock" \
-e NRIA_LICENSE_KEY=$NEW_RELIC_LICENSE_KEY -e NRIA_DISPLAY_NAME=web-01 \
newrelic/infrastructure:2.1.1- Install via package (
newrelic-infra), the CLI guided install, Ansible, Chef or Puppet, or as a container as above. - Configuration in
/etc/newrelic-infra.yml:license_key,display_name,custom_attributes(env, team). - Process samples are disabled by default on new accounts to limit volume: enable
enable_process_metricsand filter withinclude_matching_metrics.
Integrations #
- On-host: MySQL, PostgreSQL, NGINX, Apache, Redis, Kafka, RabbitMQ… run by the agent, configured in
/etc/newrelic-infra/integrations.d/. - Cloud: AWS (preferably via CloudWatch Metric Streams), Azure (Azure Monitor) and GCP, agentless, with a read-only role.
- Prometheus: the Prometheus agent or remote write to New Relic to reuse existing exporters.
2. Logs #
Collect, parse, link.
Forwarding #
# /etc/newrelic-infra/logging.d/app.yml
logs:
- name: boutique
file: /var/log/boutique/*.log
attributes:
service: boutique
env: prod
pattern: ERROR|WARN # only forward these lines- The infrastructure agent embeds Fluent Bit: one file per source in
logging.d/(files, journald, syslog, Windows logs). - Other paths: APM agents (automatic application log forwarding), OpenTelemetry Collector, Log API, cloud integrations (CloudWatch, Event Hub), Fluentd, Logstash, Vector.
Using logs #
| Feature | Role |
|---|---|
| Logs in context | agents add trace.id, span.id and the entity: jump from an error or trace to the log lines |
| Parsing rules | extract attributes (Grok, regex) at ingest |
| Patterns | automatically group similar lines to spot anomalies |
| Obfuscation rules | mask or hash sensitive data before storage |
| Drop rules | drop useless lines (DEBUG, health checks): less billed volume |
| Data partitions | separate logs with their own retention |
mutation {
nrqlDropRulesCreate(accountId: 1234567, rules: [{
action: DROP_DATA
nrql: "SELECT * FROM Log WHERE level = 'DEBUG' AND env = 'prod'"
description: "Logs DEBUG de production"
}]) { successes { id } failures { error { reason } } }
}Watch out : A drop rule is final: dropped data is never stored. Test the query first with SELECT count(*).3. Kubernetes #
Cluster, nodes, pods and events.
Installing #
helm repo add newrelic https://helm-charts.newrelic.com && helm repo update
helm upgrade --install newrelic-bundle newrelic/nri-bundle -n newrelic --create-namespace \
--set global.licenseKey=$NEW_RELIC_LICENSE_KEY --set global.cluster=prod-eu \
--set newrelic-infrastructure.privileged=true --set kube-state-metrics.enabled=true \
--set nri-kube-events.enabled=true --set newrelic-logging.enabled=true- nri-bundle bundles the Kubernetes integration (DaemonSet), kube-state-metrics, Kubernetes events, log forwarding and optionally Prometheus and Pixie.
- The cluster explorer shows nodes and pods with their status; data lives in
K8sNodeSample,K8sPodSample,K8sContainerSample,InfrastructureEvent. - The Kubernetes agents operator automatically injects APM agents (Java, Node.js, Python, .NET, Ruby, PHP) into annotated pods.
Best practice : Start with a 15 to 30 second collection interval and a namespace filter: Kubernetes quickly produces a lot of data.
Useful queries #
SELECT latest(cpuUsedCores) / latest(allocatableCpuCores) * 100 AS 'CPU %' FROM K8sNodeSample FACET nodeName
SELECT count(*) FROM K8sPodSample WHERE status != 'Running' FACET namespaceName, podName SINCE 15 minutes ago
SELECT sum(restartCountDelta) FROM K8sContainerSample FACET containerName SINCE 1 hour agoCommands to know #
Commands to know
sudo systemctl status newrelic-infra: infrastructure agent statussudo tail -f /var/log/newrelic-infra/newrelic-infra.log: agent loghelm upgrade --install newrelic-bundle newrelic/nri-bundle …: install the Kubernetes integrationSELECT count(*) FROM Log FACET service SINCE 1 hour ago: log volume per serviceSELECT average(cpuPercent) FROM SystemSample FACET hostname TIMESERIES: CPU per host
Sources #
Checked in November 2026: New Relic evolves its platform continuously (UI, plans, limits); check the documentation before relying on a detail.
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Cloud and infrastructure with Dynatrace: AWS, Azure, GCP, Kubernetes and Extensions 2.0
Monitor cloud and infrastructure with Dynatrace: AWS, Azure and GCP integrations, cloud logs, Kub...
Automating New Relic and controlling costs
Managing New Relic as code and keeping the bill under control: NerdGraph API, newrelic CLI, newre...
New Relic APM: agents, OpenTelemetry and distributed traces
Instrumenting applications with New Relic: language agents, configuration, transactions and Apdex...
Fluent Bit on Kubernetes: DaemonSet, multiline, buffering and monitoring
Deploy Fluent Bit on Kubernetes with Helm, enrich with the kubernetes filter, handle multiline lo...
Elastic Observability: logs, infrastructure, APM and synthetics
Elastic Observability features: log exploration, infrastructure inventory with Elastic Agent and ...
Alerts, service levels and incidents in New Relic
Setting up useful alerting in New Relic: policies and NRQL conditions, static and anomaly thresho...
New Relic: the observability platform at a glance
Discover New Relic: history, the unified platform and NRDB, MELT data types, entities and golden ...
NRQL: querying all your New Relic data
Mastering NRQL, New Relic's query language: SELECT … FROM structure, filters, aggregation functio...
New Relic dashboards: building, sharing and analysing
Building useful dashboards in New Relic: NRQL widgets, chart choice, template variables, facet li...