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

Feature request - NRQL string functions



Are there any string utilities in NRQL? E.g., what I’d like to do is

SELECT count(*) FROM PageView WHERE appName='myapp' FACET'https://(www\.)?slated\.com/films/', pageUrl).group() LIMIT 25 SINCE 1 day ago

(using python re language here), where I can extract a substring out of a FACET or SELECT argument.


We do have a LIKE functionality in NRQL that’s analogous to SQL’s LIKE (see There’s not a more sophisticated type of text matching currently. Can you tell us what you’re wanting to accomplish, and whether the LIKE functionality meets your needs? If not, that will help us create a proposal for our product team with your use case.


In this particular example, I’m trying to group my urlpaths by the first path element. I ended up adding a custom parameter in my request handler middleware that looks like

    path = request.path.split('/',2)
    # leave '/films/' as is, but change '/films/123/' to 'films/...'
    if len(path) > 2 and path[2]:
        path[2] = '...'
    log_newrelic_parameter('path_top', '/'.join(path))

However, newrelic already captures pathUrl, so it seems like I should be able to simply write a query that selects/groups on a string computed from the pathUrl, rather than adding that to my server stack.


So it sounds like just using pageUrl LIKE '%films%' would not work for you?

It also sounds like you might want to take a gander at the browserTransactionName attribute. This will generally be grouping URL paths in a more useful way than the raw URLs. If it’s not working for you, we can help you get your browser transaction names set up in a way that might work.


I believe what is needed here (and what I’d need as well) is a way to map multiple values of an attribute to the same facet value, e.g. count all name values that begin with “foo” to facet value “foo” and all values that begin with “bar” to facet value bar. If you have hundreds of similar transaction names and you like to group them by their type (which can be derived by a string operation), the only workaround I currently see is to have a custom attribute that does the job. As we have dozens of applications and servers we cannot just bring down / change the source, we would need to do this as part of RSQL, preferably with a regexp matching function:
select count(*) from Transaction facet REGEXP_MATCH("^(foo|bar).*", name)


Awesome detail again @jnicolai - I have added this to you request.


Does REGEXP_MATCH function is available in NRSQL as of today ?


Hey @PPitroda – This sort of functionality has not been developed at this time, but we can certainly add your +1 to our feature request tracker so that your need for this reaches our Product Management team. We appreciate the feedback!



We’d love having this functionality too!


Thanks for letting me know, @marcadores-com! I’ll pass this idea along—feel free to provide a use case or any other info you think will be helpful to us! :thumbsup:


+1 regex in NRQL would be very useful.


+1 have a use case for sub grouping a Facet


Some kind of substring that would then also be useful in a facet would be nice. Perhaps whatever is matched with the current LIKE could then be the thing that is returned or grouped on, instead of the AS name you must give currently.


Are there any plans to develop this feature in the nearest future? :smiley:


add another +1 here for the ability to group longer attributes
facets to a shorter name


+1 this would be really helpful!


+1 I too wish this existed


Thanks for the +1s folks - getting this submitted internally right now :smiley:


is there any update on this one?


Reading through this, maybe I missed it. However, I think the string functions should be critical in the select clauses as well. All one has to do is have a need to, which an example may be server1 (/software) as 2 fields. servername = server1 and instance = /software.