This topic describes how to configure a table to display query results.

Chart upgrade

Log Service provides charts (Pro) to display query and analysis results. You can use a chart (Pro) to visualize the results of multiple query statements. You can also configure custom settings for fields. You can click Migrate to convert a common table to a table (Pro). For more information about the table (Pro), see Table (Pro).

Notice
  • You cannot transpose the rows or columns of a table (Pro).
  • After you convert a common chart to a chart (Pro), you cannot convert the chart (Pro) to a common chart.

Background information

Tables are used to sort and display data for quick reference and analysis. All query results that match specified query statements can be rendered into visualized charts. By default, the query results are displayed in a table.

Procedure

  1. Log on to the Log Service console.
  2. In the Projects section, click the name of the project that you want to manage.
  3. Choose Log Storage > Logstores and click the Logstore that you want to manage.
  4. Enter a query statement in the search box, select a time range, and then click Search & Analyze.
  5. On the Graph tab, click the Table - 001 icon.
  6. Click the Properties tab and configure the properties of the table.
    Parameter Description
    Items per Page The number of entries to return on each page.
    Transpose Rows and Columns Specifies whether to transpose rows and columns.
    Hide Field The field to be hidden. If you select a field, the field is not displayed in the table.
    Hide All Reserved fields Specifies whether to hide all reserved fields of Log Service. For information about reserved fields, see Reserved fields.
    AutoFit Column Width Specifies whether you can manually adjust the column width in the corresponding dashboard.
    Metric Filter If you turn on Metric Filter, you can filter metrics to view specific types of data.
    Disable Sorting If you turn on Disable Sorting, you can disable the sorting feature.
    Disable Search If you turn on Disable Search, you can disable the search feature.
    Format The format in which data is displayed.
    Font Size The font size of the value. You can drag the slider to adjust the font size. Valid values: 12 to 24. Unit: pixels.
    Highlight Settings If you turn on Highlight Settings, you can create rules to highlight matched rows or columns.
    Sparkline If you turn on Sparkline, you can add an area chart, a line chart, or a column chart for columns in the table.

Examples

You can filter fields in raw logs. The following figure shows a raw log. Raw log
  • To filter the request_method, request_uri, and request_time fields in the latest 10 logs, execute the following query statement:
    * | SELECT request_method, request_uri, request_time GROUP BY request_method, request_uri, request_time LIMIT 10
    Table - 01
  • To query the average of the request_time field values (the average request time) in a specified time range and round the average to three decimal places, execute the following query statement:
    * | SELECT round(avg(request_time), 3) as average_request
    Table - 01
  • To group the values of the remote_addr field in a specified time range and sort the values in descending order, execute the following query statement:
    * | SELECT remote_addr, count(*) as count GROUP BY remote_addr ORDER BY count DESC
    Table - 01