Queries the details of a log monitoring metric.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeLogMonitorAttribute

The operation that you want to perform. Set the value to DescribeLogMonitorAttribute.

MetricName String Yes cpu_total

The name of the log monitoring metric. Exact match is supported.

For more information, see Appendix 1: Metrics.

Response parameters

Parameter Type Example Description
Code String 200

The HTTP status code.

Note The status code 200 indicates that the call was successful.
LogMonitor Struct N/A

The details of the log monitoring metric.

Aggregates Array of Aggregate N/A

The aggregate functions.

Alias String HostName

The alias of the aggregate function.

FieldName String hostName

The name of the field in logs.

Function String count

The function that is used to aggregate the monitoring data of logs within an aggregation period. Valid values:

  • count: counts the number.
  • sum: calculates the total value.
  • avg: calculates the average value.
  • max: selects the maximum value.
  • min: selects the minimum value.
  • countps: calculates the counted number of the specified field divided by the total number of seconds of the aggregation period.
  • sumps: calculates the total value of the specified field divided by the total number of seconds of the aggregation period.
  • distinct: counts the number of logs where the specified field appears within the aggregation period.
Max String 10

The maximum value.

Min String 0

The minimum value.

GmtCreate Long 1547431398000

The time when the log monitoring metric was created.

This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC.

GroupId Long 12345

The ID of the application group.

Groupbys List value

The dimension based on which the data is grouped. This parameter is equivalent to the GROUP BY clause in SQL statements. If no dimension is specified, all data is aggregated based on the aggregate function.

LogId Long 1234

The ID returned by Log Service.

MetricExpress String {"extend":{"errorPercent":"5XXNumber/TotalNumber*100"}}

The extended field. The extended field allows you to perform basic operations on the aggregation results.

Assume that you have calculated TotalNumber and 5XXNumber by aggregating the data. TotalNumber indicates the total number of HTTP requests, and 5XXNumber indicates the number of HTTP requests whose status code is greater than 499. You can calculate the server error rate by adding the following formula to the extended field: 5XXNumber/TotalNumber*100.

MetricName String cpu_total

The name of the log monitoring metric. For more information, see Appendix 1: Metrics.

SlsLogstore String test-logstore

The name of the Log Service Logstore.

SlsProject String test-project

The name of the Log Service project.

SlsRegionId String cn-hangzhou

The ID of the region where the Log Service Logstore resides.

Tumblingwindows List 60

The size of the tumbling window for calculation. Unit: seconds. The system performs an aggregation for each tumbling window.

ValueFilter Array of ValueFilterObject N/A

The condition that is used to filter logs. The ValueFilter and ValueFilterRelation parameters are used in pair. The filter condition is equivalent to the WHERE clause in SQL statements.

If no filter condition is specified, all logs are processed. Assume that logs contain the Level field, which may be set to Error. If you need to calculate the number of times that logs of the Error level appear every minute, you can set the filter condition to Level=Error and count the number of logs that meet this condition.

Key String hostName

The name of the log field used for matching in the filter condition.

Operator String contain

The method that is used to match the field value. Valid values:

  • contain
  • notContain
  • >: greater than
  • <: less than
  • >=: greater than or equal to
  • <=: less than or equal to
Value String portal

The field value to be matched in the filter condition.

ValueFilterRelation String and

The logical operator that is used between log filter conditions. The ValueFilter and ValueFilterRelation parameters are used in pair. Valid values:

  • and
  • or
Message String successful

The returned message. If the call was successful, the value success is returned. If the call failed, an error message is returned.

RequestId String C6718537-E673-4A58-8EE1-24B8B38C7AAE

The ID of the request.

Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.


Sample requests

&<Common request parameters>

Sample success responses

XML format


JSON format

  "Message": "successful",
  "RequestId": "BBD7B294-1325-46D1-BD08-848D6A6B9AC6",
  "LogMonitor": {
    "SlsProject": "slsProject",
    "Tumblingwindows": [
    "SlsLogstore": "slsLogstore",
    "MetricExpress": "{\"extend\":{}}",
    "GroupId": 12345,
    "MetricName": "cpu_total",
    "GmtCreate": 1577766395000,
    "Aggregates": [
        "Function": "count",
        "Min": "",
        "Max": "",
        "Alias": "lh_source_count",
        "FieldName": "lh_source"
    "Groupbys": [],
    "ValueFilterRelation": "and",
    "ValueFilter": [
        "Operator": "contais",
        "Value": "test",
        "Key": "hostName"
    "LogId": 1234,
    "SlsRegionId": "cn-hangzhou"
  "Code": 200,
  "Success": true

Error codes

For a list of error codes, visit the API Error Center.