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 for target fields and enable the statistics feature.
- When you use SQL statements for search and analysis, single quotes ('') indicate strings, and double quotes ("") indicate fields and aliases.
An analysis statement is composed of a search rule and SQL statement, which are separated by a vertical bar (|).
[Search rule] | [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.|
|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 GROUP BY clauses)||Each analysis returns up to 2,000 results.||Default: 100; Maximum: 2,000|