We've made it easier than ever to query and extract useful data from strings such as URLs, log messages, and more, using Regex capture. Regular expressions are an extremely powerful tool for finding patterns in strings—and with Regex capture, you can now leverage that power to improve your NRQL queries.
Regex capture works directly within NRQL using the
capture function, allowing you to use regular expressions in your queries to extract focused data, such as this:
capture function takes two arguments. The first is the
request_url: the attribute containing the URL string. The second argument is a regular expression pattern. Regex capture is built on Re2 syntax, a regular expression library created by Google.
As an example, the below query will find which accounts are using specific service endpoints (the
request_url) most frequently:
FROM Transaction SELECT count(*) WHERE request_url LIKE '%data%' LIMIT 50 FACET capture(request_url, r'.*/accounts/(?P<account>\d+).*')
Get started today