All Products
Search
Document Center

CloudMonitor:DescribeLogMonitorAttribute

Last Updated:Mar 01, 2024

Queries the details of a log monitoring metric.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
MetricNamestringYes

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

For more information, see Appendix 1: Metrics.

cpu_total

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The HTTP status code.

Note The status code 200 indicates that the call was successful.
200
Messagestring

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

successful
RequestIdstring

The ID of the request.

C6718537-E673-4A58-8EE1-24B8B38C7AAE
Successboolean

Indicates whether the call was successful. Valid values:

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

The details of the log monitoring metric.

ValueFilterRelationstring

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

  • and
  • or
and
SlsLogstorestring

The name of the Log Service Logstore.

test-logstore
MetricNamestring

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

cpu_total
GroupIdlong

The ID of the application group.

12345
LogIdlong

The ID returned by Log Service.

1234
MetricExpressstring

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.

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

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

cn-hangzhou
GmtCreatelong

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.

1547431398000
SlsProjectstring

The name of the Log Service project.

test-project
Aggregatesobject []

The aggregate functions.

Maxstring

The maximum value.

10
Minstring

The minimum value.

0
Functionstring

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.
count
Aliasstring

The alias of the aggregate function.

HostName
FieldNamestring

The name of the field in logs.

hostName
ValueFilterobject []

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.

Keystring

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

hostName
Valuestring

The field value to be matched in the filter condition.

portal
Operatorstring

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
contain
Tumblingwindowsarray

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

string
60
Groupbysarray

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.

string
value

Examples

Sample success responses

JSONformat

{
  "Code": "200",
  "Message": "successful",
  "RequestId": "C6718537-E673-4A58-8EE1-24B8B38C7AAE",
  "Success": true,
  "LogMonitor": {
    "ValueFilterRelation": "and",
    "SlsLogstore": "test-logstore",
    "MetricName": "cpu_total",
    "GroupId": 12345,
    "LogId": 1234,
    "MetricExpress": "{\"extend\":{\"errorPercent\":\"5XXNumber/TotalNumber*100\"}}",
    "SlsRegionId": "cn-hangzhou",
    "GmtCreate": 1547431398000,
    "SlsProject": "test-project",
    "Aggregates": [
      {
        "Max": "10",
        "Min": "0",
        "Function": "count",
        "Alias": "HostName",
        "FieldName": "hostName"
      }
    ],
    "ValueFilter": [
      {
        "Key": "hostName",
        "Value": "portal",
        "Operator": "contain"
      }
    ],
    "Tumblingwindows": [
      "60"
    ],
    "Groupbys": [
      "value"
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400ParameterInvalidIllegal parameters.-
403AccessForbiddenUser not authorized to operate on the specified resource.-
404ResourceNotFoundThe specified resource is not found.The specified resource is not found.
500InternalErrorThe request processing has failed due to some unknown error.-

For a list of error codes, visit the Service error codes.