Grouped and stacked column charts

Updated at:
Copy as MD

Configure grouped and stacked column charts to compare metrics across categories in Log Service dashboards.

Prerequisites

Overview

On the Search & Analysis page, run an SQL statement such as * | select request_url, COUNT(*) as pv, approx_distinct(remote_address) as uv where request_url is not null GROUP BY request_url ORDER BY uv to calculate pv and uv statistics grouped by URL, then display the results as a grouped column chart.

  1. Search & Analysis: Query and analyze logs, including searches, aggregations, and statistics.

  2. Add a chart: Each dashboard chart represents one or more query statements.

  3. Configure a grouped or stacked column chart: Set two Y-axis fields and enable stacking as needed.

Step 1: Query and analyze data

  1. Log on to the Simple Log Service console. In the Projects section, click the project you want.

    image

  2. On the Log Storage > Logstores tab, click the logstore you want.

    image

  3. Enter a query and analysis statement, and click Last 15 Minutes to set the time range.

    Example:

    • Use the approx_distinct function to estimate the number of unique remote addresses per request URL.

      * | select request_url, COUNT(*) as pv, approx_distinct(remote_address) as uv GROUP BY request_url ORDER BY uv

Step 2: Add a chart

  1. In the left-side navigation pane, choose Dashboard > Dashboards. In the Dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, choose Add > Add Chart.

    image

  2. On the General Configurations > Chart Type > image. On the Query and Analysis tab, select Logstore (SQL), select the target Logstore, and enter a query statement.

    Select a time range from the upper-right drop-down list, such as Last 15 Minutes. Click OK > Save.

    Under Query and Analysis Configurations, select request_url as the Axis X Field, and uv and pv as the Axis Y Field.

Step 3: Configure stacking and colors

Configure stacking

In the Column Settings > Stacking > Yes to stack the grouped column chart.

On the Search & Analysis page of the Log Service console, you can run an SQL statement such as * | select request_url, COUNT(*) as pv, approx_distinct(remote_address) as uv where request_url is not null GROUP BY request_url ORDER BY uv to calculate pv and uv statistics grouped by URL. The query results are then displayed as a grouped column chart to compare traffic across URLs.

Configure colors

In the Standard Configurations > Color Scheme > Solid, then specify display colors for the pv and uv fields.