The SQL statistics feature of CLS can analyze the collected logs and display the analysis results using different types of charts, such as line chart, bar chart, and pie chart. You can choose any type as needed.
To use the log analysis feature, you must configure the key-value index of statistical fields and enable statistics.
An analysis statement is composed of search criterion and SQL statement, which are separated by a vertical bar (|).
[Search criterion] | [SQL statement]
Calculate the page views (PV) without a search criterion. * | select count(*) as pv
Calculate the PV with status code 404 as the search criterion. status:404 | select count(*) as pv
WHEREsyntax. For more information, see SQL syntax.
FROMclause for SQL statements. Data from the current log topic is analyzed by default.
CLS supports the following SQL syntax and functions. You can click them to view details.
|SELECT||Selects data from tables.|
|AS||Specifies an alias for a column (KEY).|
|GROUP BY||Combines aggregate functions to group results based on one column (KEY) or more.|
|ORDER BY||Sorts results according to the specified
|LIMIT||Limits the amount of data returned by the
|WHERE||Extracts the logs that meet the specified criteria.|
|Maximum length of a single statistical field (Value)||The maximum length of a single statistical field (Value) is 32 KB. Any statement exceeding this limit will be truncated.||-|
|Number of non-cluster analysis results (excluding
||Each analysis returns up to 1,000 results.||Default: 100; Maximum: 1,000|
|Number of cluster analysis results (including
||Each analysis returns up to 100 results.||Default: 100; Maximum: 2,000|