This topic describes how to configure a table to display query results. It also includes some examples.

Background information

Tables are the most common method to sort and display data for quick reference and analysis. All search and analytics results in Log Service can be rendered by using visualized charts. The query results are displayed in a table by default.

The basic elements of a table are follows:
  • Table header
  • Row
  • Column
where:
  • You can use a SELECT statement to specify the number of columns.
  • The number of rows is computed based on the number of log entries in the specified time range. The default clause is LIMIT 100.

Procedure

  1. Log on to the Log Service console.
  2. Click the target project in the Projects section.
  3. Choose Log Management > Logstores, click the management icon of the target Logstore, and then select Management icon > Search & Analysis.
  4. Enter a query statement in the search box, select a time range, and then click Search & Analyze.
  5. Click Table - 001 to display the query results in a table.
  6. On the Properties tab on the right, configure the properties of the table.
    Configuration item 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 Reserved Fields Specifies whether to hide reserved fields.
    Disable Sorting Specifies whether to disable the sorting feature.
    Disable Search Specifies whether to disable the search feature.
    Highlight Settings The rules for highlighting rows or columns that conform to rules.
    Sparkline The Sparkline feature that you can use to add an area chart, line chart or column chart for columns in the table.

Examples

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