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
Required parameters for apply_config_to_machine_group:
|
Parameter |
Type |
Required |
Example |
Description |
|
--project_name |
String |
Yes |
aliyun-test-project |
Project name. |
|
--config_name |
String |
Yes |
config_name2 |
Logtail configuration name. |
|
--group_name |
String |
Yes |
group_name2 |
Machine group name. |
For information about the global parameters of the Log Service command-line interface (CLI), see Global parameters.
Examples
-
List existing Logtail configurations:
aliyunlog log list_logtail_config --project_name="aliyun-test-project"Sample output:
{ "configs": [ "windows_event_log", "test-zhengze4", "config_name2", "metric_system" ], "count": 4, "total": 4 } -
List existing machine groups:
aliyunlog log list_machine_group --project_name="aliyun-test-project"Sample output:
{ "count": 3, "machinegroups": [ "group_name", "group_name2", "host_metric" ], "total": 3 } -
Apply a Logtail configuration to a machine group with the default account:
aliyunlog log apply_config_to_machine_group --project_name="aliyun-test-project" --config_name="config_name2" --group_name="group_name2" -
Verify the configuration applied to group_name2:
aliyunlog log get_machine_group_applied_configs --project_name="aliyun-test-project" --group_name="group_name2"Sample output:
{ "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.