All Products
Search
Document Center

Simple Log Service:How do I select appropriate fields to configure data features?

Last Updated:Jul 22, 2024

A data source includes many fields that can be used for intelligent inspection. A data source can be a Logstore or a Metricstore. This topic describes how to select appropriate fields to configure data features.

When you configure data features, you can specify metric data and non-metric data for Data Type. The data feature configurations vary based on the data type.

  • For the metric data, the algorithm model uses consumer groups to extract metrics and intelligently inspect the metrics.

  • For non-metric data, the algorithm model uses the custom query statements that you specify to extract metrics and intelligently inspect the metrics.

Log examples

In most cases, logs that are intelligently inspected are in the following forms:

  • Log A

    __time__: 1631794322
    service_name: front-end
    host_name: front-end-davadf-0
    process_pid: 9
    cpu_util: 0.8
    mem_util: 34
    avg_load: 10.534
    disk_util: 0.112
  • Log B

    __time__: 1631794322
    service_name: front-end
    host_name: front-end-davadf-0
    process_pid: 9
    metric_name: cpu_util
    value: 0.8

Configuration example 1

The algorithm model uses consumer groups to extract metrics and intelligently inspect the metrics.

  • Log A

    • Specify __time__ for the Time parameter.

    • Specify service_name, host_name, and process_pid for the Entity parameter.

      Note

      An entity may have multiple process_pid values at each point in time. If you specify only service_name and host_name and do not specify process_pid for the Entity parameter, you cannot specify a unique entity, and the algorithm model cannot identify the data features of the entity.

    • Specify cpu_util, mem_util, avg_load, and disk_util for the Feature parameter.

  • Log B

    • Specify __time__ for the Time parameter.

    • Specify service_name, host_name, process_pid, and metric_name for the Entity parameter.

      Note

      An entity may have multiple process_pid values and metric_name values at each point in time. If you specify only service_name and host_name and do not specify process_pid or metric_name for the Entity parameter, you cannot specify a unique entity, and the algorithm model cannot identify the data features of the entity.

    • Specify value for the Feature parameter.

Configuration example 2

The algorithm model uses the custom query statements that you specify to extract metrics and intelligently inspect the metrics.

Note

After data is aggregated by using SQL statements, the Entity parameter can be used to identify the unique entity.

  • Log A

    • Specify the following query statement: * | select __time__-__time__%60 as __time__, avg(cpu_util) as cpu_util, avg(mem_util) as mem_util, service_name, host_name from log group by __time__, service_name, host_name limit 1000.

    • Specify __time__ for the Time parameter.

    • Specify service_name and host_name for the Entity parameter.

    • Specify cpu_util, mem_util, and disk_util for the Feature parameter.

  • Log B

    • Specify the following query statement: * | select __time__-__time__%60 as __time__, avg(if(metric_name = 'cpu_util', value, 0)) as value, service_name, host_name from log group by __time__, service_name, host_name limit 1000.

    • Specify __time__ for the Time parameter.

    • Specify service_name and host_name for the Entity parameter.

    • Specify value for the Feature parameter.