The table is the most common data display form and the most basic data sorting method for quick reference and analysis. Log Service provides a feature similar to SQL aggregate computing. It allows you to use query and analysis statements to obtain results and display the data results in a table.

Components

  • Table header
  • Row
  • Column

where:

  • You can use a SELECT clause to specify the number of columns.
  • The number of rows is computed based on the number of logs in the current time interval. The default clause is LIMIT 100.

Procedure

  1. On the search page of a Logstore, enter a query and analysis statement in the search box, set the time range, and then click Search & Analysis.
  2. On the Graph tab that appears, view the data that is automatically displayed in a table. You do not need to click .
  3. On the right-side Properties tab, configure the properties of the table.

Properties

Configuration item Description
Items per Page The number of entries to return on each page.
Zebra Striping Specifies whether to obtain a zebra-striped table.
Transpose Rows and Columns Click it 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 highlight rules for highlighting rows or columns that conform to rules.

Example

You can filter data in raw logs. The following figure shows a raw log.

Figure 1. Raw log


  1. To filter the method, request_size, and request_time fields in the latest 10 logs, run the following statement:
    * | SELECT method, request_size, request_timetus GROUP BY method, request_size, request_time LIMIT 10
    Figure 2. Case 1


  2. To compute the data of a field, for example, the average value of request_size (the average request time) in the current time interval, and obtain the result that is accurate to three decimal places, run the following statement:
    * | SELECT round(avg(request_size), 3) as average_request
    Figure 3. Case 2


  3. To compute grouped data, for example, the distribution of client_ip in the current time interval and sort the data in descending order, run the following statement:
    * | SELECT client_ip, count(*) as count GROUP BY client_ip ORDER BY count DESC
    Figure 4. Case 3