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

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

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!