matches

The matches operator can be used to match a string to a wildcard pattern, such as "*iPhone*error". The return of the operator is boolean; the operator can be used with where or if expressions.

Matches operators can be used in Dashboard Panels, and are very commonly used in conjunction with other operators to build robust queries.

Syntax:

... [string expression] matches [pattern] ...

... if [string expression] matches [pattern] ...

... where [string expression] matches [pattern]...

... !([string expression] matches [pattern])...

Rules:

The matches operator does not support regular expressions.

Examples:

Identifying the browsers and operating systems used to access your website.

Running a query containing a matches operator on Apache Access logs can show you the breakdown of the devices and browsers that are accessing your site. You can then create a Dashboard with this query. We've used a transpose operator in this query to allow us to name the axis of our column chart.

Produces aggregate results similar to the following, when you configure it to create a stacked column chart:

Viewing errors and warnings over time.

In this example, we'll run a query against Windows logs to see the distribution of errors and warnings over the previous hours. Using a timeslice operator in the query breaks the results into one-hour buckets.

Recommended articles

Sumo Logic is the industry’s leading secure, cloud-native, machine data analytics service, delivering real-time, continuous intelligence across the entire application lifecycle and stack. More than 1,000 customers around the globe rely on Sumo Logic for the analytics and insights to build, run and secure their modern applications and cloud infrastructures.