All Products
Search
Document Center

Simple Log Service:Configure settings for search and filter, variable replacement, and multi-statement query

Last Updated:Nov 18, 2024

This topic describes how to configure common features for a table. The features include search and filter, variable replacement, and multi-statement query.

Prerequisites

Overview

image

  1. Query and analyze data: You can query and analyze the collected logs in the Simple Log Service console. For example, you can retrieve logs, aggregate logs, and collect statistics on logs.

  2. Add a chart: Each dashboard consists of multiple charts. Each chart displays the results of one or more query statements.

  3. Configure common features: You can configure the search and filter, variable replacement, and multi-statement query for a table.

Step 1: Query and analyze data

  1. Log on to the Simple Log Service console. In the Projects section, click the project you want.

  2. In the left-side navigation pane, click Log Storage. In the Logstores list, click the logstore you want.

    image

  3. Enter a query statement in the search box and click Last 15 Minutes to specify a query time range.

    Example:

Step 2: Add a table

  1. In the left-side navigation pane, choose Dashboard > Dashboards. In the dashboard list, click the dashboard you want. In the upper-right corner of the dashboard page, click Edit. In edit mode, click Add > Add Chart.

    image

  2. On the General Configurations tab, click the Table Pro icon in the Chart Types section. On the Search & Analysis tab, select Logstore (SQL) and choose the logstore you want, and enter the query statement. Select a time range, such as Last 15 Minutes, and click OK.

    image

Step 3: Configure common features for a table

Search and filter

  • Search

    • Field/Column Settings > Search Mode > Search: The search feature supports all fields in a table.

    • Click the image icon to the right of a column name and enter a keyword for searching.

      image

  • Filter

    • Field/Column Settings > Search Mode > Search: The filter feature supports all fields in a table.

    • Click the image icon to the right of a column name and click the image icon. You can select multiple options for filtering.

      image

Variable replacement

Variable Replacement > Add Variable Replacement: Set the Variable Key parameter to date and the Display Name parameter to time. Then, configure parameters in the Variable Values section. Set the Display Name parameter to min and the Replacement Value parameter to 100. In this case, the date variable in Query Statement A is replaced with min.

image

After you configure the settings, a filter appears in the upper-left corner of the chart. If you select a value from the filter drop-down list, Simple Log Service performs a query and analysis operation based on the value that you select. The following query statement is executed: * | select __time__ - __time__ % 100 as time,request_method.

image

Multi-statement query

Add Query > Logstore(SQL): Select a Logstore named request_path, enter the * | select * query statement, and then click Apply. Then, select Query Statement B to view the query results.

image