Skip to main content
Sumo Logic

Metric Query Builder

Learn how to create a query with the metric query builder.

You can use the metrics query builder to construct metric queries by selecting metadata fields, dimensions, metrics, and operators from pulldown lists. This makes it easier to create your search scope and to apply operators to the metrics that are returned. You’ll still want to understand the functionality of metric operators, but the metric query builder helps you by prompting you with a list of available operators, and after you choose an operator, the options or qualifiers that the operator supports.

About the UI

This section is a brief introduction to the Metric Query Builder UI. This screenshot shows the UI with a query already built.

ui.png

The key components of the UI are:

  1. The From area is where you define the scope of your metric query, using metadata and metric dimensions. When you click in this area, you’re presented with a drop down list of the metadata fields and dimensions associated with the metrics you’ve ingested. When you select a metadata field or dimension, you’re presented with a list of values for the selected field or dimension. In our example query, we selected two dimensions, cluster and availabilityzone. The more metadata fields and dimensions you select, the narrower your query will be.
  2. The get metric area is where you select the metric you want to return. When you click in this area, you’re presented with a list of metrics that match the scope you defined in the From area. In our example query, we selected the CPU_LoadAvg_15min metric. 
  3. In this area, you can apply one or more metric operators to metric query results. When you click the plus (+) sign, you’re presented with a list of metric operators. In our example query, we selected the sum operator.    
  4. The left pane below the query builder section presents a visualization of your query results. By default, a time series plot is presented. You can select a different visualization method, although not all visualizations make sense for every query. You can click the Preview Table to switch to a tabular view of the time series returned by your query.
  5. In the Visualization Type area, you can select a different visualization type: Categorical, Single Value, Map, and Honeycomb. 
  6. The icons in the toolbar on the right side of the page allow you to customize your chart. 
  7. The icons on the right side of the query builder area allow you to add a query, hide a query, clear a query, enter advanced mode, and duplicate a query.

Create a metric query

  1. In the Sumo Logic UI, click + New and choose Metrics from the drop-down list.
  2. The Metric Query Builder opens. Click the From field. A list of metadata fields and metric dimensions appears.
    from-field-list.png
  3. Scroll through the list, or begin typing to dynamically narrow the list. Click a field or dimension. In the screenshot below, we clicked the _collector metadata field. A drop down list of values for the selected item appears.from-field-list-values.png
  4. Scroll through the list, or begin typing to dynamically narrow the list. Click the desired value. The From field now contains the key-value pair you selected, and the metrics that match your selector are listed in the Preview Table. preview-table.png
  5. As desired, repeat the previous steps to add additional selectors to the From field. 
  6. Click the get metric field. Scroll through the list, or begin typing to dynamically narrow the list. Select the desired metric from the list.
    metric-list.png
  7. The Preview Table now lists the time series that match your current query.preview-table-final-query.png
  8. At any time, you can click Chart to see a visualization of the metrics. chart-icon.png
  9. The chart area now displays a visualization of the selected metric.results-2.png
  10. To apply an operator, click the plus sign to the right of the get metric area, and select a metric from the list.
    operator-icon.png
  11. The chart area updates to show your query results with the operator applied.
    results-3.png
  12. Apply additional operators to the query, as desired. 

Add another metric query

You can specify up to six queries in the Metric Query Builder.

To add an additional query

  1. Click the plus sign (+) to the right of the query builder area.
    multiple-queries-1.png
  2. A new row, labeled #B is added to the query builder area.
    multiple-queries-2.png
  3. Follow the steps in Create a metric query to build another query.
  4. Your visualization is updated to chart the additional query.
    multiple-queries-3.png

Hide a query

You can hide a query so that it is not visualized in the chart.

  1. Click the eye icon to the right of the query builder area in the row that contains the query you want to hide.
    multiple-queries-4.png
  2. The visualization for the query is hidden. Note that the query label for a hidden is faded out.
    multiple-queries-5.png
  3. To make the query visible, click the eye icon again.

Add a monitor to a metric query

  1. Select Create alert from the more options menu.create-alert.png
  2. Follow the instructions on Create a monitor and alert.

Duplicate a metric query

  1. Select Duplicate Query from the more options menu.
    duplicate-query.png
  2. Your query will be copied to a new row in the query builder area.

Switch to Advanced Mode

You can switch to the Metric Query Builder’s Advanced Mode if you would like to enter your query free-form, rather than using the query builder UI. To do so, select Advanced Mode from the more options menu.

Add a metric chart to a dashboard

To add a metric chart to a dashboard, click the Add to Dashboard button in the upper right corner of the Metric Query Builder.