All Products
Search
Document Center

CloudMonitor:ModifyHybridMonitorTask

Last Updated:Jul 26, 2024

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

Operation description

This topic provides an example on how to change the collection period of a metric import task whose ID is 36**** to 15 seconds. The task is used to monitor the logs that are imported from Log Service. 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.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
cms:ModifyHybridMonitorTaskupdate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TaskIdstringYes

The ID of the metric import task.

For information about how to obtain the ID of a metric import task, see DescribeHybridMonitorTaskList .

36****
TaskNamestringNo

The name of the metric import task.

For information about how to obtain the ID of a metric import task, see DescribeHybridMonitorTaskList .

SLS_task
DescriptionstringNo

The description of the metric import task.

CollectIntervalstringNo

The collection period of the metric. Valid values:

  • 15
  • 60

Unit: seconds.

15
AttachLabelsarray<object>No

The tags of the metric.

objectNo

None

ValuestringNo

The tag value of the metric.

testValue
NamestringNo

The tag key of the metric.

app_service
SLSProcessConfigobjectNo

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

FilterobjectNo

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

RelationstringNo

The relationship between multiple filter conditions. Valid values:

  • and (default): Logs are processed only if all filter conditions are met.
  • or: Logs are processed if one of the filter conditions is met.
and
Filtersarray<object>No

None

objectNo

None

SLSKeyNamestringNo

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

code
OperatorstringNo

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
=
ValuestringNo

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

200
Statisticsarray<object>No

None

objectNo

None

SLSKeyNamestringNo

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

name
FunctionstringNo

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

  • count: counts the number.
  • sum: calculates the total value.
  • avg: calculates the average value.
  • max: calculates the maximum value.
  • min: calculates the minimum value.
  • value: collects samples within the statistical period.
  • countps: calculates the counted number of the specified field divided by the total number of seconds within the statistical period.
  • sumps: calculates the total value of the specified field divided by the total number of seconds within the statistical period.
  • distinct: counts the number of logs where the specified field appears within the statistical period.
  • distribution: counts 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 within the statistical period. Example: P50.
count
AliasstringNo

The alias of the aggregation result.

level_count
Parameter1stringNo

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

  • If the Function parameter is set 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.
200
Parameter2stringNo

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

Note This parameter must be specified when Function is set 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.
299
GroupByarray<object>No

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

objectNo

None

SLSKeyNamestringNo

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

code
AliasstringNo

The alias of the aggregation result.

ApiResult
Expressarray<object>No

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

objectNo

None

ExpressstringNo

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

success_count
AliasstringNo

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

SuccRate

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

Response parameters

ParameterTypeDescriptionExample
object

None

Codestring

The status code.

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

The error message.

Invalid.SLSConfig
RequestIdstring

The request ID.

11145B76-566A-5D80-A8A3-FAD98D310079
Successstring

Indicates whether the request was successful. Valid values:

  • true
  • false
true

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError message
400%s%s
500InternalError%s

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

Change history

Change timeSummary of changesOperation
2022-07-11The Error code has changedView Change Details