Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Can I alert on 5xx HTTP errors, but not 4xx errors?


#1

4xx errors (like 404 not found) should be returned by web applications when users make bad requests. 5xx errors are returned when the server itself has run into problems. As such, it’s difficult to tune an alert such that it fires if there’s a serious bug without distinguishing the two.

Is there a way to define an alert that fires only off 5xx HTTP error codes?


#2

Hi, @nrook: You may use a NRQL query as an alert condition. The following query will return the number of 5xx errors that have occurred in a particular application:

SELECT count(*) 
FROM Transaction 
WHERE appName = 'My Application' AND 
httpResponseCode LIKE '5%'

Or, if you prefer, you may get the error rate as a percentage of transactions:

SELECT percentage(count(*), WHERE httpResponseCode LIKE '5%') 
FROM Transaction 
WHERE appName = 'My Application'

#3

A post was merged into an existing topic: Important: Upcoming Changes for New Relic Servers and legacy alerting features


#4

I see, that looks quite useful.

Unfortunately, I’m not currently a New Relic Insights customer. But it’s good to know that’s where that behavior is supported.


#5

FYI, if you have a Pro or Enterprise subscription to any of our other products (APM, Infrastructure, Browser, Synthetics, or Mobile), you get 8 days of Insights data at no additional charge (Essentials subscriptions get 3 days).


#6

Oh, really! I get access to a rolling window of the past 8 days of data? That would certainly be enough to support any alert I can imagine. Clicking Insights on the top bar of our APM dashboard just gets me to this page, but if there’s a way for me to get access to the last 8 days of data with no additional charge, I’m all ears. I’ll ask our CTO to talk to our sales rep. Thanks!