kopin.dev

Case study · 3 December 2026

Cutting New Relic ingest from 1300 to 450 GB a month

A Magento shop was sending about 1300 GB a month to New Relic, most of it access logs for static files, debug logs and cron traces. How we found where the gigabytes came from, what we dropped, and why filtering at the source is now cheaper than drop rules.

All articles
Dark card with the headline "You pay to store every request for a CSS file" and two bars: 1300 GB before, 450 GB after

A B2B Magento shop we worked on sent about 1300 GB a month to New Relic. The setup was ordinary: the PHP agent on the web nodes, the infrastructure agent on every VM forwarding log files, and Fastly streaming its request logs into New Relic Logs. Nobody had added anything unusual. The volume came from defaults and from logs that were switched on "for now" and never looked at again.

After the changes in this article the account settled at 400 to 500 GB a month. Nobody lost an APM chart, and we could still find slow endpoints and slow queries.

What New Relic charges for

On the usage-based plans New Relic bills two things: data ingest and users. The pricing page lists 100 GB of ingest per month for free, then $0.40 per GB for original data and $0.60 per GB for Data Plus (which adds longer retention). EU data residency adds $0.05 per GB. What counts is the size of the data that actually ends up being stored, regardless of type.

At list price for original data, 1300 GB is (1300 − 100) × $0.40 = $480 a month. 450 GB is $140. Enterprise contracts have their own rates, but the ratio stays the same.

Users are the second line on the bill. A core user costs $49 a month and a full platform user on Pro $349 with an annual commitment, while basic users are free. In our case ingest was the larger cost, so this article is about data. If your bill is dominated by seats, the fix is different: check who actually uses the full platform features and move everyone else to core or basic.

Finding out where the gigabytes come from

Do not guess. New Relic records its own usage in the NrConsumption event, and the usage queries page gives the query that splits ingest by source:

FROM NrConsumption SELECT sum(GigabytesIngested)
WHERE productLine = 'DataPlatform'
SINCE 3 months ago FACET usageMetric TIMESERIES 1 day

usageMetric tells you the product: APM events, infrastructure host data, logs, and so on. In our account three sources made up most of the volume: logs, APM span and transaction events, and infrastructure samples.

That is too coarse to act on. The next step is bytecountestimate(), which estimates how many bytes a set of events takes. It scans the actual data, so the docs recommend keeping the time range under 24 hours. Faceting it by whatever separates your noise from your signal shows where the volume is:

FROM Log SELECT bytecountestimate()/10e8 AS 'GB estimate'
SINCE 24 hours ago FACET logtype, filePath LIMIT 20
FROM Transaction SELECT bytecountestimate()/10e8 AS 'GB estimate'
SINCE 24 hours ago FACET appName, transactionType
FROM SystemSample, ProcessSample, NetworkSample, StorageSample
SELECT bytecountestimate()/10e8 AS 'GB estimate'
SINCE 24 hours ago FACET eventType()

Run the same query with different facets until one row explains a large share of the total. For logs that was the access logs. For APM it was background work: Magento cron and CLI commands produce long transactions with thousands of segments. For infrastructure it was ProcessSample.

What we dropped

Access logs for static files

The biggest single item. Every request for a CSS file, a product image or a web font was logged twice: once by nginx on the web node (forwarded by the infrastructure agent) and once by Fastly, which streams every request into New Relic Logs through its New Relic logging endpoint. Most of those lines are cache hits with status 200 that nobody will ever query.

We kept access logs for pages, API calls and checkout, and dropped everything with a static file extension.

Logs below WARNING

Magento writes debug.log and system.log through Monolog, and several modules log at INFO and NOTICE on every request. We kept WARNING and above. For logs coming from the PHP agent this is already the default: newrelic.application_logging.forwarding.log_level is WARNING unless someone lowered it, as the PHP agent configuration reference shows. Our noise came from log files forwarded by the infrastructure agent, which sends whatever is in the file.

Detail from cron and CLI, not their errors

Magento cron runs indexers, queue consumers and imports. Each run is a non-web transaction (transactionType = 'Other' in the attribute dictionary), often minutes long, with spans for every SQL query. We dropped their transaction events with a rule, cut their spans in the agent (below), and kept their errors (TransactionError). If an import breaks, we still see the exception and the stack trace. What we gave up is the detailed timeline of a run that worked.

Process metrics

The infrastructure agent can report a ProcessSample for every running process every 20 seconds. On a Magento web node with dozens of PHP-FPM workers that adds up fast. Process metrics are off by default for accounts created after July 20, 2020, but older accounts have them on. We switched them off in newrelic-infra.yml. Setting the sample rate to -1 also stops the agent from collecting them, not only from sending them:

# /etc/newrelic-infra.yml
enable_process_metrics: false
metrics_process_sample_rate: -1

If you need one or two processes (say, the queue consumers), include_matching_metrics limits reporting to those, as described in the agent configuration settings.

Fewer spans per trace

The PHP agent records up to 2000 span events per harvest cycle by default (newrelic.span_events.max_samples_stored). For web transactions it captures all segments (newrelic.transaction_tracer.max_segments_web = 0), for CLI runs up to 100000 (max_segments_cli). We lowered all three:

; /etc/php/8.3/mods-available/newrelic.ini
newrelic.span_events.max_samples_stored = 500
newrelic.transaction_tracer.max_segments_web = 2000
newrelic.transaction_tracer.max_segments_cli = 2000

The numbers are an example: start lower than the default, then check that the traces of your slowest endpoints still show where the time goes. When the segment limit is reached the agent samples segments and keeps the highest priority ones. Traces become less complete: you might not see every cache lookup in a slow request. They still show which endpoint is slow and which query or external call takes the time, which was what we used them for.

None of this touches the APM summary charts. Response time, throughput and error rate in APM come from metric timeslice data, a separate data format that drop rules cannot drop and agent sampling does not reduce.

Drop rules then, cloud rules now

We did the log and cron filtering with NRQL drop rules. A drop rule is an NRQL query registered through NerdGraph; matching data is discarded on arrival and, per the docs, does not count towards your data ingest. Our rules looked roughly like this:

mutation {
  nrqlDropRulesCreate(accountId: 1234567, rules: [{
    action: DROP_DATA
    nrql: "SELECT * FROM Log WHERE level IN ('DEBUG', 'INFO', 'NOTICE')"
    description: "Logs below WARNING"
  }]) {
    successes { id }
    failures { error { reason description } }
  }
}

That API is gone. New customers could not create NRQL drop rules from May 2025, and they reached end of life on August 31, 2026. New Relic migrated existing rules to Pipeline Control cloud rules. The same filters are now written as DELETE statements:

mutation {
  entityManagementCreatePipelineCloudRule(pipelineCloudRuleEntity: {
    name: "Magento cron transactions"
    description: "Detail from non-web transactions, errors are kept"
    nrql: "DELETE FROM Transaction WHERE appName = 'shop' AND transactionType = 'Other'"
    scope: { id: "1234567", type: ACCOUNT }
  }) {
    entity { id name nrql enabled }
  }
}

A rule can also delete single attributes instead of whole events (DELETE attr1, attr2 FROM Log WHERE ...), which helps when one field, like a full request body, makes up most of an event's size. The cloud rules API page has the full syntax, and the Pipeline Control UI offers the same thing without NerdGraph. Check the attribute names in your own data before copying conditions: level, logtype and appName depend on how your sources are set up.

Two things changed with the move, and they change the advice.

First, cloud rules require New Relic Compute pricing or the Advanced Compute add-on. The API page says so directly, and the EOL notice says pay-as-you-go and free accounts without Advanced Compute had their drop rules disabled. Our account is on Advanced Compute, so our rules kept working. On a plain ingest-plus-users plan you no longer have this option at all.

Second, dropping is no longer free. The Pipeline Control overview charges cloud rules by data dropped (7.5 GB per aCCU) plus events scanned. The price of an aCCU depends on your edition and contract and is not on the public pricing page, so I cannot give you a per-GB figure. Look it up in your contract and compare it with your ingest price.

Either way, data that New Relic receives and then deletes costs something. Data that never leaves your servers costs nothing.

Filtering at the source

So the order we would follow today is: stop the data where it is produced, and use cloud rules only for what cannot be filtered there.

Three places to drop data: at the source (Fastly, nginx, infrastructure agent, PHP agent) for free, in a Pipeline Control cloud rule for aCCU, or not at all and pay ingest per GB

For Fastly, a logging endpoint has a response_condition field: the name of a condition that must be true for the request to be logged. A condition with this expression logs everything except static files:

!(req.url.ext ~ "(?i)^(css|js|map|png|jpe?g|gif|svg|webp|avif|ico|woff2?|ttf)$")

For nginx on the web nodes, the if= parameter of access_log skips a request when the variable is 0 or empty:

map $uri $loggable {
    ~*\.(css|js|map|png|jpe?g|gif|svg|webp|avif|ico|woff2?|ttf)$  0;
    default                                                       1;
}

access_log /var/log/nginx/access.log main if=$loggable;

If Fastly already logs every request, it is worth asking whether the nginx access log needs to go to New Relic at all, or only the requests that bypass Fastly.

For log files forwarded by the infrastructure agent, the pattern option in logging.d works like grep -E and forwards only matching lines. Monolog writes the level as channel.LEVEL:, so for Magento logs:

# /etc/newrelic-infra/logging.d/magento.yml
logs:
  - name: magento-system
    file: /var/www/shop/var/log/system.log
    pattern: \.(WARNING|ERROR|CRITICAL|ALERT|EMERGENCY):
  - name: magento-exception
    file: /var/www/shop/var/log/exception.log

pattern can only include lines, not exclude them. For anything more complex you can point the agent at your own Fluent Bit configuration, which New Relic does not officially support.

What stays with cloud rules is the cron transaction events. The PHP agent has a separate segment limit for CLI, but no setting that stops Transaction events for non-web runs while keeping them for web requests, so that filter is easier to express after the fact.

What we would add next

Two things we have not done yet on that project.

An alert on ingest. Ingest grows without anyone deciding it should: a new module, a log level left at DEBUG after an incident. New Relic suggests alerting on NrMTDConsumption, the month-to-date figure that also feeds the usage UI:

FROM NrMTDConsumption SELECT latest(GigabytesIngested)
WHERE productLine = 'DataPlatform'

A static threshold at, say, 80% of the monthly budget catches slow growth. The anomaly detection tutorial adds an anomaly condition on hourly NrConsumption to catch the sudden kind: a module that starts logging every request after a deploy.

Cheaper staging. Staging environments often run the same agents and settings as production, with a fraction of the traffic but the same log forwarding and cron traces. newrelic.enabled = false turns the PHP agent off for a site, and an infrastructure agent without logging.d sends only host metrics. Where staging needs APM to debug something, it can be switched on for that week.

The trade-off

Every filter above removes something you might want one day. After the change we could not replay the full timeline of a successful import, and a slow request trace no longer showed every cache call. In exchange the account went from 1300 to between 400 and 500 GB a month, and the data that remained was the data we actually queried. When a filter turns out to be too aggressive, it is one config line or one rule to undo, and that is cheaper than storing everything just in case.

Get Started

I Help Companies Move Faster