Transpose table rows and columns

Updated at:
Copy as MD

Transpose table rows and columns on a dashboard to reformat data for easier import, export, and analysis.

Prerequisites

Overview

The following steps show how to transpose table rows and columns on a dashboard chart:

  1. Query and analyze data: Search, aggregate, and compute statistics on log data in the console.

  2. Add a chart: Add a chart to the dashboard. Each chart is driven by one or more query statements.

  3. Transpose rows and columns: Swap the rows and columns of the query result.

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 statement, then click Last 15 Minutes to specify the time range.

    Example: query the top 10 request paths by count:

    * | select split_part(request_uri,'?',1) as path, count(1) as count group by split_part(request_uri,'?',1) order by count desc limit 10

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. In the General Configurations section, select the image icon for Chart Type. On the Query and Analysis tab, select your data source (in this case, LogStore (SQL)), choose the target Logstore, and enter a query statement.

    In the upper-right corner, select a time range, such as Last 15 Minutes, from the drop-down list and click Apply.

    Set Chart Type to Table. An example query statement is * | select *.

Step 3: Transpose rows and columns

Data Conversion > Transpose Rows and Columns > Select Data Source: Transpose the rows and columns for query A.

On the chart editing page, click the Data Conversion tab, set Type to Transpose Rows and Columns, and select A from the data source drop-down list.