Skip to main content
Sumo Logic

Lab 6 - Filter Time Series using advanced query mode

This lab teaches you to filter and aggregate to limit your search to the data you need.
Getting into Advanced Query Mode

For Labs 6-10, you are going to use the advanced query mode in the Metrics panel.  To do this, on each query you want to switch to advanced query mode, click on the three dots in a vertical line at the far right of the query line and select Advanced Mode as shown below.

  1. To visualize your data, click New in the tab bar and select Metrics.

This will open a new Metric query in basic mode.  Ensure it is in Advanced Mode, by clicking below as necessary: In your next query will fill use the filter statement and in order to use that statement, you will need to be in advanced metric query mode. 


Once you have switched to Advanced Mode, your query display will look like this and you can type in your metric or log query directly. This is what your interface should look like:

The difference between Basic and Advanced Query modes where discussed in the last lab.  Additional information can be found here.

Creating Filter Time Series and other operators

When you want to filter metrics, you can use a mathematical expression in your query to combine aggregate functions, comparison and boolean operators, and numerical values to help limit your search to the data you need.

You can use the following metrics operators to filter a time series:

  • topk -  take the top X time series

  • bottomk - take the bottom X  time series

  • filter - take a specific math function of a time series (max, min, avg, sum)

For this lab we will use the filter operator to look at the CPU_Sys metrics associated with our device.

  1. You can identify the metadata fields available by using the inline search ahead next to Metric  


We could select _contentType=  and then select the specific content type we are looking for

  1. Select _contentType= and then select hostmetrics as shown below:


Complete this query by adding the source category of your computer's host metrics and specifying the metric of CPU_Sys.  Hint:  _sourceCategory=hostmetrics/<your initials> metric=CPU_Sys
Note: the CPU_Sys provides information about the CPU utilization by your core operating system. 

Using the filter operator you can reduce down your time series. 

For example:

_contentType= HostMetrics _sourceCategory = hostmetrics/<your_initials> metric=CPU_Sys

Please note that depending on your host thresholds for your filter may vary. Try this first without the filter statement and then add the filter, and adjust to see your data results. 

1. Now add the | filter min > 0 and max < 10 as shown below:


2. Select Chart and your result should look similar to this:

This helps you focus on areas of interest in your metrics data, and remove the additional “noise” of less important data. For example, to see only those CPU metrics where the average over the query time range is greater than 95:

metric=CPU_Sys | filter avg > 95


Congratulations - you have created queries in the advanced query mode and seen how to use the filter statement.  Well done!!!