Log Service allows you to configure drill-down events for raw logs to visualize logs and obtain more log details. You can configure default events and advanced events. This topic describes how to configure events for raw logs in the Log Service console.
Prerequisites
- The indexing feature is enabled and configured. For more information, see Configure indexes.
- A Logstore is created if you configure an advanced event to open a Logstore. For more information, see Create a Logstore.
- A saved search is created if you configure an advanced event to open a saved search.
For more information, see Saved search.
Placeholder variables are configured in the destination saved search if you configure variables. For more information, see Set a placeholder variable.
- A dashboard is created if you configure an advanced event to open a dashboard. For
more information, see Create a dashboard.
Placeholder variables are configured in the destination dashboard if you configure variables. For more information, see Set a placeholder variable.
- An HTTP link is created if you configure an advanced event to open a custom HTTP link.
Background information
Drilling is an essential feature in data analysis. This feature allows you to view more details by moving to different layers of data. Drilling includes rolling up and drilling down. Drilling down allows you to move to deeper data layers to gain an insight into data. This way, you can extract more value from data and make informative decisions. Log Service allows you to configure default events and advanced events to analyze raw logs.
Configure default events
When you configure default events, you can add conditions to query statements by using the AND and OR operators or create new query statements.

* | SELECT status as dim, count(1) as c group by dim
. If you click the value 203.0.113.1 in the host field, the query statement in the
search box varies based on the event action you select.
Event action | Description | Result |
---|---|---|
Add to Query | Append the keyword that you click to the query statement by using the AND operator and query the data. | * and host: "203.0.113.1" | SELECT status as dim, count(1) as c group by dim |
Exclude from Query | Append the keyword that you click to the query statement by using the NOT operator. | * not host: "203.0.113.1" | SELECT status as dim, count(1) as c group by dim |
Add Search | Delete the query statement from the search box and create a query statement by using the specified keyword. | * and host: "203.0.113.1" |
Configure advanced events
You can configure advanced events for log fields to analyze logs at a deeper level. You can configure an advanced event to open a Logstore, saved search, dashboard, or a custom HTTP link.


Example
The following example describes how to store access logs in a Logstore named accesslog. In this example, a saved search is created to query the page view (PV) distribution of IP addresses and request methods. On the Raw Logs page, set the advanced event for the remote_addr field to open a saved search. Then, click remote_addr. You are redirected to the saved search to view the PV distribution.
__source__:127.0.0.1
__tag__:__receive_time__:1613759995
__topic__:nginx_access_log
body_bytes_sent:5077
host:www.example.com
http_referer:www.example.com
http_user_agent:Mozilla/5.0 (X11; CrOS i686 12.0.742.91) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/192.0.2.2 Safari/534.30
http_x_forwarded_for:192.0.2.1
remote_addr:192.0.2.0
remote_user:gp_02
request_length:3932
request_method:POST
request_time:35
request_uri:/request/path-2/file-4
status:200
time_local:19/Feb/2021:18:39:50
upstream_response_time:0.09
- Query the PV distribution of requests whose request method is POST and status code
is 200. Create a saved search named PV Distribution of IP Addresses and Request Method. The following example shows the query statement and query result:
* and request_method: POST and status: 200 | select count(*) as pv, remote_addr as ip,request_method as method group by ip,method order by ip desc
- Set the
method
andstatus2
variables in the query statement. The following example shows the query statement:* and request_method: ${method} and status: ${status2} | select count(*) as pv, remote_addr as ip,request_method as method group by ip,method order by ip desc
- On the Raw Logs tab, set the advanced event for the remote_addr field to Open Saved Search and set the following parameters.
- Select Quick Query: Select PV Distribution of IP Addresses and Request Method.
- Filter: You do not need to specify the parameters on this tab.
- Variables: Set the key of a static variable to status2 and the value to 400. Set the key of a dynamic variable to method and the value to request_method.
- On the Raw Logs tab, choose In the raw log entry, the request_method is GET and the status is 404.
.
- Click the name of the saved search. The following query statement is displayed in
the window that appears:
* and request_method: GET and status: 400 | select count(*) as pv, remote_addr as ip,request_method as method group by ip,method order by ip desc
- View the query result of the saved search.
In this example, the value of the static variable status2 is 400, which indicates the status field. The value of the request_method field is GET and the dynamic value of the variable method is GET. The result of the saved search shows the PV distribution of IP addresses whose request method is GET and status code is 400.
For example, the value of the request_method field is PUT. The result of the saved search shows the PV distribution of IP addresses whose request method is PUT and status code is 400.