Applies a Logtail configuration to a machine group.
Request syntax
aliyunlog log apply_config_to_machine_group --project_name=<value> --config_name=<value> --group_name=<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 apply_config_to_machine_group
command.
For information about the global parameters of the Log Service command-line interface
(CLI), see Global variables.
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
--project_name | String | Yes | aliyun-test-project | The name of the project. |
--config_name | String | Yes | config_name2 | The name of the Logtail configuration. |
--group_name | String | Yes | group_name2 | The name of the machine group. |
Examples
- Query the existing Logtail configurations. Run the following command:
The following output is returned:aliyunlog log list_logtail_config --project_name="aliyun-test-project"
{ "configs": [ "windows_event_log", "test-zhengze4", "config_name2", "metric_system" ], "count": 4, "total": 4 }
- Query the existing machine groups. Run the following command:
The following output is returned:aliyunlog log list_machine_group --project_name="aliyun-test-project"
{ "count": 3, "machinegroups": [ "group_name", "group_name2", "host_metric" ], "total": 3 }
- Use the default account to apply a Logtail configuration to a machine group. Run the
following command:
aliyunlog log apply_config_to_machine_group --project_name="aliyun-test-project" --config_name="config_name2" --group_name="group_name2"
- Query a machine group named group_name2 to which a Logtail configuration is applied.
Run the following command:
The following output is returned:aliyunlog log get_machine_group_applied_configs --project_name="aliyun-test-project" --group_name="group_name2"
{ "configs": [ "config_name2" ], "count": 1 }
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 of ApplyConfigToMachineGroup.