RousselTMLEARNING

Article · New Relic: from discovery to expertise

Infrastructure, logs and Kubernetes

1. The infrastructure agent #

Hosts and processes.

Overview #

Infrastructure layer

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_metrics and filter with include_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 #

FeatureRole
Logs in contextagents add trace.id, span.id and the entity: jump from an error or trace to the log lines
Parsing rulesextract attributes (Grok, regex) at ingest
Patternsautomatically group similar lines to spot anomalies
Obfuscation rulesmask or hash sensitive data before storage
Drop rulesdrop useless lines (DEBUG, health checks): less billed volume
Data partitionsseparate 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 ago

Commands to know #

Commands to know
  • sudo systemctl status newrelic-infra : infrastructure agent status
  • sudo tail -f /var/log/newrelic-infra/newrelic-infra.log : agent log
  • helm upgrade --install newrelic-bundle newrelic/nri-bundle … : install the Kubernetes integration
  • SELECT count(*) FROM Log FACET service SINCE 1 hour ago : log volume per service
  • SELECT 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.

📄 Infrastructure, logs and Kubernetes with New Relic →

My progress

  • ⏱ Estimated time : ≈ 7 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

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....

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!