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
New Relic best practices
Best practices to succeed with New Relic: adoption approach, account organization, naming and tag...
Fluent Bit: parsers and filters, structuring and transforming logs
Structure and transform logs in Fluent Bit: parsers (json, regex, logfmt, ltsv), multiline parser...
Datadog on Kubernetes: Operator, Cluster Agent and Autodiscovery
Monitor Kubernetes with Datadog: the Datadog Operator and the DatadogAgent resource, Cluster Agen...
Digital experience: Browser, mobile and Synthetics
Measuring what users experience with New Relic: browser agent (page load, Core Web Vitals, AJAX, ...
Datadog: the SaaS observability platform at a glance
What Datadog is, its products (infrastructure, logs, APM, RUM, synthetics, security), its concept...
Terraform across multiple clouds: AWS, Azure, Google Cloud, OVHcloud and Kubernetes
Use Terraform with the main providers: aws, azurerm, google, ovh and openstack, kubernetes and he...
Sending telemetry to ClickStack: OpenTelemetry SDKs, collectors, logs, Kubernetes and browser sessions
Feeding ClickStack: ingestion key, OpenTelemetry SDK variables, forwarding through an existing co...
OpenTelemetry on Kubernetes: Operator, auto-instrumentation and Collector
Deploy OpenTelemetry on Kubernetes: Collector deployment modes (DaemonSet, Deployment, sidecar, S...
Installing the Datadog agent and configuring integrations
Install the Datadog agent on Linux, Docker and Kubernetes (Datadog Operator), understand datadog....