Log Service allows you to configure a drill-down event for a chart to obtain more detailed analysis results. This topic describes how to configure a drill-down event in the Log Service console.

Prerequisites

  • The indexing feature of a Logstore is enabled, and indexes are created. For more information, see Configure indexes.
  • If the drill-down event that you configure is to open a Logstore, you must create a Logstore. For more information, see Create a Logstore.
  • If the drill-down event that you configure is to execute a saved query statement, you must create and save a query statement. For more information, see Saved search.

    If you want to configure a variable, you must configure a placeholder variable in the saved query statement. For more information, see Set a placeholder variable.

  • If the drill-down event that you configure is to open a dashboard, you must create a dashboard. For more information. see Create a dashboard.

    If you need to configure a variable, you must configure a placeholder variable for a chart on the destination dashboard. For more information, see Set a placeholder variable.

  • If the drill-down event that you configure is to open a custom HTTP link, you must create an HTTP link.

Background information

Drilling is required for data analysis. This feature allows you to analyze data in a finer-grained or coarser-grained manner. Drilling includes roll-up and drill-down. Drill-down allows you to obtain more detailed analysis results, which help you make better decisions for your business.

Procedure

  1. Log on to the Log Service console.
  2. In the Projects section, click the project in which you want to query and analyze logs.
  3. On the Log Storage > Logstores tab, click the Logstore where logs are stored.
  4. Enter a query statement in the search box, specify a time range, and then click Search & Analyze.
  5. On the Graph tab, click a chart type. On the Properties tab, configure the parameters.
    For more information about the properties of a chart, see Overview of statistical charts.
  6. Click the Interactive Behavior tab. On this tab, configure a drill-down event for the chart.

    You can set Event Action to Disable, Open Logstore, Open Saved Search, Open Dashboard, Open Dashboard, or Custom HTTP Link.

    • Disable: disables the drill-down feature.
    • Open Logstore: configures the drill-down event to open a Logstore. If you set Event Action to Open Logstore, you must configure the following parameters.
      Parameter Description
      Open in New Tab Specifies whether to open the Logstore on a new tab. If you turn on the switch, the Logstore is opened on a new tab when the drill-down event is triggered.
      Select Logstore The name of the Logstore. When a drill-down event is triggered, you are redirected to the query and analysis page of the Logstore.
      Time Range The time range during which the data in the Logstore is queried. Valid values:
      • Default: queries data in the Logstore to which you are redirected based on the default time range. The default time range is 15 minutes and accurate to the second.
      • Inherit table time: queries data in the Logstore to which you are redirected based on the time range specified for the chart on which the drill-down event is triggered.
      • Relative: queries data in the Logstore to which you are redirected based on the time range you select. The time range is accurate to the second.
      • Time Frame: queries data in the Logstore to which you are redirected based on the time range you select. The time range is accurate to the minute, hour, or day.
      Inherit Filtering Conditions If you turn on Inherit Filtering Conditions, the filter conditions that are saved to the dashboard are synchronized to the query and analysis page of the Logstore to which you are redirected when the drill-down event is triggered. The filter conditions are added before the query statement by using the AND operator.
      Filter On the Filter tab, you can enter a filter statement. When the drill-down event is triggered, the filter statement is synchronized to the query and analysis page of the Logstore to which you are redirected. The filter statement is added before the query statement by using the AND operator.

      The filter statement can contain fields that you specify in the Optional Parameter Fields field.

    • Open Saved Search: configures the drill-down event to execute a saved query statement.
      Parameter Description
      Open in New Tab Specifies whether to execute the specified saved query statement on a new tab. If you turn on the switch, the specified saved query statement is executed on a new tab when the drill-down event is triggered.
      Select Saved Search The name of the saved query statement that you want to execute.
      Time Range The time range during which the saved query statement queries data. Valid values:
      • Default: queries data by using the saved query statement based on the default time range. The default time range is 15 minutes and accurate to the second.
      • Inherit table time: queries data by using the saved query statement based on the time range specified for the chart when the drill-down event is triggered.
      • Relative: queries data by using the saved query statement based on the time range you select. The time range is accurate to the second.
      • Time Frame: queries data by using the saved query statement based on the time range you select. The time range is accurate to the minute, hour, or day.
      Inherit Filtering Conditions If you turn on Inherit Filtering Conditions, the filter conditions that are added to the dashboard are synchronized to the saved query statement that you want to execute when the drill-down event is triggered. The filter conditions are added before the saved query statement by using the AND operator.
      Inherit Variables If you turn on Inherit Variables and the variable that you configure on the dashboard is the same as the variable in the saved query statement, the variable value on the dashboard replaces the variable in the saved query statement.
      Note If you want to use this feature, you must configure a placeholder variable in the saved query statement.
      Filter On the Filter tab, you can enter a filter statement in the Filter Statement field. When the drill-down event is triggered, the filter statement is added before the saved query statement by using the AND operator.

      The filter statement can contain fields that you specify in the Optional Parameter Fields field.

      Variable Log Service allows you to use variables to modify the saved query statement. If you configure a variable that is the same as the variable in the saved query statement, the variable value that you click to trigger the drill-down event replaces the variable in the saved query statement. You can add variables on the Variable tab.
      Note
      • If you want to configure a variable, you must first configure a placeholder variable for the saved query statement that you want to execute.
      • You can add up to five dynamic variables and up to five static variables.
      • Dynamic variables
        • Variable: the name of the variable.
        • Variable Value Column: the column in which the variable values are located. The values are used to dynamically replace the variable in the saved query statement.
      • Static variables
        • Variable: the name of the variable.
        • Value: the static value of the variable, which is used to replace the variable in the saved query statement.
    • Open Dashboard: configures the drill-down event to open a dashboard. If you set Event Action to Open Dashboard, you must configure the following parameters.
      Parameter Description
      Open in New Tab Specifies whether to open the specified dashboard on a new tab. If you turn on this switch, the specified dashboard is opened on a new tab when the drill-down event is triggered.
      Select Dashboard The name of the dashboard to which you want to be redirected.
      Time Range The query time range for the dashboard. Valid values:
      • Default: queries data for the dashboard to which you are redirected based on the default time range. The default time range is 15 minutes and accurate to the second.
      • Inherit table time: queries data for the dashboard to which you are redirected based on the time range specified for the chart when the drill-down event is triggered.
      • Relative: queries data for the dashboard to which you are redirected based on the time range you select. The time range is accurate to the second.
      • Time Frame: queries data for the dashboard to which you are redirected based on the time range you select. The time range is accurate to the minute, hour, or day.
      Inherit Filtering Conditions If you turn on Inherit Filtering Conditions, the filter conditions that are added to the current dashboard are synchronized to the dashboard to which you are redirected when the drill-down event is triggered.
      Inherit Variables If you turn on Inherit Variables, the variables that you configure on the current dashboard are synchronized to the dashboard to which you are redirected.
      Filter On the Filter tab, you can enter a filter statement in the Filter Statement field. When the drill-down event is triggered, the filter statement can be synchronized to the dashboard to which you are redirected.

      The filter statement can contain fields that you specify in the Optional Parameter Fields field.

      Variable The variables that you configure are synchronized to the dashboard to which you are redirected when the drill-down event is triggered. You can add variables on the Variable tab.
      Note
      • If you want to configure a variable, you must first configure a placeholder variable on the dashboard to which you are redirected.
      • You can add up to five dynamic variables and up to five static variables.
      • Dynamic variables
        • Variable: the name of the variable.
        • Variable Value Column: the column in which the variable values are located. The values are dynamically synchronized to the dashboard to which you are redirected.
      • Static variables
        • Variable: the name of the variable.
        • Value: the static value of the variable, which is synchronized to the dashboard to which you are redirected.
    • Custom HTTP Link: configures the drill-down event to open a custom HTTP link.

      The path in the custom HTTP link is the path of the file that you want to access. You can add an optional parameter to the path. If you click a variable value on a chart to trigger the drill-down event, the added parameter is replaced with the value, and you are redirected to the custom HTTP link.

      Parameter Description
      Enter Link The address to which you want to be redirected.
      Use System Variables If you turn on Use System Variables, you can insert the system variables of Log Service into the custom HTTP link. The variables include ${sls_project}, ${sls_dashboard_title}, ${sls_chart_name}, ${sls_chart_title}, ${sls_region}, ${sls_start_time}, ${sls_end_time}, ${sls_realUid}, and ${sls_aliUid}.
      Transcoding If you turn on Transcoding, the custom HTTP link is encoded.
      Optional Parameter Fields If you add an optional parameter to the path, the added parameter is replaced with the value that you click to trigger the drill-down event.
  7. Click Add to New Dashboard.
  8. In the dialog box that appears, configure the dashboard name and chart name. Then, click OK.

Examples

This section provides an example on how to store NGINX access logs in a Logstore named accesslog and how to create two dashboards named RequestMethod and destination_drilldown to configure a drill-down event. Add a table of request methods to the RequestMethod dashboard, and configure a drill-down event for the table to open the destination_drilldown dashboard. Add a line chart to the destination_drilldown dashboard. The line chart displays the change of page views (PVs) over time. If you click a request method on the RequestMethod dashboard, you are redirected to the destination_drilldown dashboard. Then, you can view the change of the number of PVs over time on the destination_drilldown dashboard.

  1. Create the destination_drilldown dashboard.
    Before you configure a drill-down event for the table of request methods, you must create a dashboard to which you want to be redirected and add a line chart to the dashboard. The line chart displays the change of the number of PVs over time. For more information, see Add charts to a dashboard.
    • Configure the query statement.
      The query statement queries logs by request type. You can view the change of the number of PVs over time.
      request_method: * | SELECT date_format(date_trunc('minute', __time__), '%H:%i:%s') AS time, COUNT(1) AS PV GROUP BY time ORDER BY time
    • Configure a placeholder variable.
      Specify the asterisk (*) as a placeholder variable and name the variable method. Placeholder variable
  2. Configure a drill-down event for the table of request methods and add the table to the RequestMethod dashboard.
    For more information, see procedure.
    • Configure the query statement.

      The query statement queries the logs that are generated for each request method among the NGINX access logs.

      *|SELECT request_method, COUNT(1) AS c GROUP BY request_method ORDER BY c DESC LIMIT 10
    • Select a chart type.

      In this example, select the table.

    • Configure a drill-down event for the table.
      • Configure a drill-down event for the request_method column in the table.
      • Select destination_drilldown for Select Dashboard.
      • Set Variable to method.
      Event Action
  3. View drill-down results.

    On the RequestMethod dashboard, click GET. You are redirected to the destination_drilldown dashboard. The asterisks (*) in the query statement is replaced with the value GET. The change of the number of PVs for GET requests over time is displayed in a line chart.

    request_method
    Dashboard to which you are redirected