Log Parsing in New Relic: Turning Raw Lines Into Queryable Data

Structured logs answer questions; raw text just sits there

A raw log line like 2026-11-20 10:42:01 ERROR order=8812 user=553 payment timeout 3021ms is hard to chart. Parse it into attributes and you can query SELECT average(duration) FROM Log WHERE level = 'ERROR' FACET errorType.

Best Option: Log in JSON

If you control the app, log structured JSON (Pino for Node.js, structured logging libraries elsewhere). New Relic parses JSON automatically.

Built-In Parsing

New Relic has built-in rules for common formats: Apache, NGINX, syslog, and more. Set the logtype attribute when forwarding logs.

Custom Parsing Rules With Grok

%{TIMESTAMP_ISO8601:timestamp} %{LOGLEVEL:level} order=%{NUMBER:orderId} user=%{NUMBER:userId} %{GREEDYDATA:message} %{NUMBER:durationMs:int}ms

Create the rule with a matching NRQL condition (e.g. logtype = 'orders') and test it against sample logs in the UI.

Log Patterns

New Relic's log patterns use machine learning to group similar log lines. You can see that 90% of your volume is one repeated message — a great clue for noise reduction.

Obfuscation

Define rules to mask or hash sensitive data (emails, card numbers, tokens) at ingest.

Logs in Context

When APM agents add trace and span IDs to logs, you can jump from a trace to its exact log lines.

Queries

SELECT count(*) FROM Log WHERE level = 'ERROR' FACET service TIMESERIES SINCE 6 hours ago

Parsing is the difference between logs you store and logs you use.

Arivanandhan Chitheshwaran