Modifies the information of a machine group.
Request syntax
aliyunlog log update_machine_group --project_name=<value> --group_detail=<value> [--access-id=<value>] [--access-key=<value>] [--sts-token=<value>] [--region-endpoint=<value>] [--client-name=<value>] [--jmes-filter=<value>] [--format-output=<value>] [--decode-output=<value>]
Request parameters
The following table describes the required and specific parameters of the update_machine_group command.
Parameter | Type | Required | Example | Description |
--project_name | String | Yes | aliyun-test-project | The name of the project. |
--group_detail | JSON Object | Yes | file://./machinegroup.json | The modified configuration file of the machine group. |
For information about the global parameters of the Log Service command-line interface (CLI), see Global parameters.
Examples
Modify a file named machinegroup.json in which the machine group name is group_name2. The following example shows the content of the machinegroup.json file:
{ "machine_list": [ "machine1", "machine2" ], "machine_type": "userdefined", "group_name": "group_name2", "group_type": "", "group_attribute": { "groupTopic": "topic x" } }
The following table describes the parameters.
Parameter
Description
machine_list
The identifiers of the servers in the machine group.
If you set the machineIdentifyType parameter to ip, enter the IP addresses of the servers in the machine group.
If you set the machineIdentifyType parameter to userdefined, enter custom IDs. For more information about how to configure a custom ID, see Create a custom ID-based machine group.
machine_type
The type of the machine group identifier. Valid values:
ip: The machine group uses IP addresses as identifiers.
userdefined: The machine group uses custom IDs as identifiers.
group_name
The name of the machine group. The name must meet the following requirements:
The name must be unique in a project.
The name can contain only lowercase letters, digits, hyphens (-), and underscores (_).
The name must start and end with a lowercase letter or a digit.
The name must be 3 to 128 characters in length.
group_type
The type of the machine group. Valid values: null.
group_attribute
The attribute of the machine group. For more information about the group_attribute parameter, see the following table.
The following table describes the parameters in group_attribute.
Parameter
Description
groupTopic
The topic of the machine group.
Use the default account to modify the configuration file of a machine group named group_name2.
aliyunlog log update_machine_group --project_name="aliyun-test-project" --group_detail="file://./machinegroup.json"
Query the information of the machine group. Run the following command:
aliyunlog log get_machine_group --project_name="aliyun-test-project" --group_name="group_name2"
The following output is returned:
{ "createTime": 1622105480, "groupAttribute": { "externalName": "", "groupTopic": "topic x", "osType": "", "policy": "", "region": "" }, "groupName": "group_name2", "groupType": "", "lastModifyTime": 1622105480, "machineIdentifyType": "userdefined", "machineList": [ "machine1", "machine2" ] }
Error codes
If an error message is returned, fix the error based on the error codes of the related API operation. For more information, see Error codes.