Modifies a metric for the logs that are imported from Log Service.

This topic provides an example on how to modify the collection period of the SLS_task metric for the logs that are imported from Log Service to 15 seconds. The returned result indicates that the metric is modified.

Debugging

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 ModifyHybridMonitorTask

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

TaskId String Yes 36****

The ID of the data monitoring task.

TaskName String Yes SLS_task

The name of the data monitoring task.

Description String No Monitoring data of logs from Log Service

The description of the data monitoring task.

CollectInterval String No 15

The collection period of the metric. Valid values:

  • 15
  • 60

Unit: seconds.

SLSProcessConfig Object No

The configurations of the logs that are imported from Log Service.

Filter Object No

The conditions that are used to filter logs imported from Log Service.

Relation String No and

The relationship between multiple filter conditions. Default value: and. Valid values:

  • and: CloudMonitor processes the logs that meet all specified filter conditions.
  • or: CloudMonitor processes the logs that meet one of the specified filter conditions.
Filters Array No

None.

SLSKeyName String No code

The name of the key that is used to filter logs imported from Log Service.

Operator String No =

The method that is used to filter logs imported from Log Service. Valid values:

  • contain: contains
  • notContain: does not contain
  • >: greater than
  • <: less than
  • =: equal to
  • ! =: not equal to
  • >=: greater than or equal to
  • <=: less than or equal to
Value String No 200

The value of the key that is used to filter logs imported from Log Service.

Statistics Array No

None.

SLSKeyName String No name

The name of the key that is used to aggregate logs imported from Log Service.

Function String No count

The function that is used to aggregate log data of a statistical period. Valid values:

  • count: calculates the number of values of the specified field.
  • sum: calculates the sum of the values of the specified field.
  • avg: calculates the average of the values of the specified field.
  • max: calculates the maximum value of the specified field.
  • min: calculates the minimum value of the specified field.
  • value: collects samples within the statistical period.
  • countps: calculates the sum of the values of the specified field divided by the total number of seconds of the statistical period.
  • sumps: calculates the number of values of the specified field divided by the total number of seconds of the statistical period.
  • distinct: calculates the number of unique values of the specified field within the statistical period.
  • distribution: calculates the number of logs that meet a specified condition within the statistical period.
  • percentile: sorts the values of the specified field in ascending order, and then returns the value that is at the specified percentile (such as P50) within the statistical period.
Alias String No level_count

The alias of the aggregation result.

Parameter1 String No 200

The value of the function that is used to aggregate logs imported from Log Service.

  • If you set the Function parameter to distribution, this parameter specifies the lower limit of the statistical interval. For example, if you want to calculate the number of HTTP requests whose status code is 2XX, set this parameter to 200.
  • If you set the Function parameter to percentile, this parameter specifies the percentile at which the expected value is. For example, 0.5 specifies P50.
Parameter2 String No 299

The value of the function that is used to aggregate logs imported from Log Service.

Note This parameter is required only if you set the Function parameter to distribution. This parameter specifies the upper limit of the statistical interval. For example, if you want to calculate the number of HTTP requests whose status code is 2XX, set this parameter to 299.
GroupBy Array No

The dimension based on which data is aggregated. This parameter is equivalent to the GROUP BY clause in SQL.

SLSKeyName String No code

The name of the key that is used to aggregate logs imported from Log Service.

Alias String No ApiResult

The alias of the aggregation result.

Express Array No

The extended fields that specify the results of basic operations performed on aggregation results.

Express String No success_count

The extended field that specifies the result of basic operations performed on aggregation results.

Alias String No SuccRate

The alias of the extended field that specifies the result of basic operations performed on aggregation results.

AttachLabels.N.Value String No testValue

The tag value of the metric.

AttachLabels.N.Name String No app_service

The tag key of the metric.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
Code String 200

The HTTP status code.

Note The status code 200 indicates that the call was successful.
Message String Invalid.SLSConfig

The error message.

RequestId String 11145B76-566A-5D80-A8A3-FAD98D310079

The ID of the request.

Success String true

Indicates whether the call was successful. Valid values:

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

Examples

Sample requests

http(s)://[Endpoint]/?Action=ModifyHybridMonitorTask
&TaskId=36****
&TaskName=SLS_task
&CollectInterval=15
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyHybridMonitorTaskResponse>
    <RequestId>11145B76-566A-5D80-A8A3-FAD98D310079</RequestId>
    <Code>200</Code>
    <Success>true</Success>
</ModifyHybridMonitorTaskResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "11145B76-566A-5D80-A8A3-FAD98D310079",
  "Code" : 200,
  "Success" : true
}

Error codes

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