Log template discovery is used to perform offline, intelligent analysis of log data to extract and manage common templates from logs. This feature helps you quickly understand your log data. This topic describes how to read text logs from consumer groups for template discovery.
Prerequisites
-
Logs are collected to a source Logstore or Metricstore. For more information, see Data collection and Collect time series data.
ImportantThe logstores that are described in this topic are Standard logstores. For more information, see Manage a logstore.
Create a log template discovery job
Log on to the Simple Log Service console.
-
Navigate to the job creation page.
-
In the Log Application area, on the Intelligent Operations and Maintenance (O&M) tab, click Intelligent Anomaly Analysis.
-
In the instance list, click the target instance.
-
In the navigation pane on the left, choose .
-
In the upper-right corner of the Log Template Discovery Task area, click Create Now.
-
-
In the Basic Information step of the Create Template Discovery Job wizard, perform the following operations:
-
Configure parameters such as Task Name, Project, Logstore Type, and Source Logstore. All task results are written to a Logstore named
internal-ml-login the current Project. -
Create the
AliyunLogETLRolerole. Simple Log Service assumes this role to obtain data. Click Next.
-
-
In the Algorithm Configuration step of the Create Template Discovery Job wizard, configure the required algorithms.
Log clustering algorithm
Parameter
Description
Number of templates
Move the slider to control the number of log templates to be generated. You cannot precisely control the number of log templates, but you can adjust the approximate range.
Query statement
The filter condition for logs that are used for LogReduce. Template discovery is performed on logs that meet the filter condition.
Template discovery algorithm
Parameter
Description
Log entity field
Groups log data based on the values of the log entity field. Template discovery is performed separately on the log data in each group. You can select or enter up to two fields.
Log level field
The field used to identify the risk level or severity of a log, such as
infoorerror. If an error occurs when the log level field is parsed or the field is empty, the log level isunknown.Log text field
Select the log fields to be analyzed. The text analytics job concatenates the values of the selected fields and analyzes them as a whole. If the target field is not in the drop-down list, you can enter it manually. If you configure a blacklist, the algorithm analyzes all log fields except for the blacklisted fields. If you configure a whitelist, the algorithm analyzes only the whitelisted fields.
Important-
An index is not required.
-
Log template discovery and log template matching analyze text content. The value of the corresponding log field must be of the
texttype. Otherwise, the value is automatically converted to thetexttype. -
If the values of all specified fields do not exist, the text analytics job does not perform statistical analysis on the corresponding log.
Number of templates
Move the slider to control the number of log templates to be generated. You cannot precisely control the number of log templates, but you can adjust the approximate range.
Start time, End time
The time range of the logs to be analyzed.
-
-
Click Complete. The created log template discovery job appears on the Job Resources tab.
-
Optional: In the Actions column for the target job resource, click the
icon to edit or delete the job.ImportantA log template discovery job cannot be recovered after it is deleted. Perform this operation with caution.
View the progress of a log template discovery job
Log on to the Simple Log Service console.
-
Open the Job Details page.
-
In the Log Application area, on the Intelligent O&M tab, click Intelligent Anomaly Analysis.
-
In the instance list, click the target instance.
-
In the navigation pane on the left, choose .
-
On the Job Resources tab, click the target job ID to view the job's running progress, the number of discovered templates, and any exceptions that occurred during runtime.
-
View the results of a log template discovery job
Log on to the Simple Log Service console.
-
Open the Resource Details page.
-
In the Log Application area, on the Intelligent O&M tab, click Intelligent Anomaly Analysis.
-
In the instance list, click the target instance.
-
In the navigation pane on the left, choose .
-
On the Template Resources tab, find the required template resource based on its description and click its ID.

-
On the Template Resource page, you can view the log templates discovered by the job, and create, delete, modify, and annotate them.

-