Modifies the configurations of a machine group. If a Logtail configuration file for log collection is applied to the machine group, the configuration file is disassociated from the server that you remove from the machine group or associate with the server that you add to the machine group.

Request syntax

PUT /machinegroups/{groupName} HTTP/1.1
Authorization: <AuthorizationString> 
Content-Type:application/json
Content-Length:<Content Length>
Content-MD5<:<Content MD5>
Date: <GMT Date>
Host: <Project Endpoint>
x-log-apiversion: 0.6.0
x-log-signaturemethod: hmac-sha1
{
    "groupName": "test-machine-group",
    "groupType" : "",
    "groupAttribute" : {
        "externalName" : "testgroup",
        "groupTopic": "testgrouptopic"
    },
    "machineIdentifyType" : "ip",
    "machineList" : [
        "test-ip1",
        "test-ip2"
    ]
}

Request elements

  • Request headers

    The UpdateMachineGroup API operation does not have operation-specific request headers. For information about the common request headers of Log Service API operations, see Common request headers.

  • Parameters
    URL parameters
    Parameter Type Required Example Description
    groupName string Yes test-machine-group The name of the machine group.
    Request body parameters
    Parameter Type Required Example Description
    groupName string Yes test-machine-group The name of the machine group. The name must be unique in a project.
    groupType string No None. The type of the machine group. Default value: null.
    machineIdentifyType string Yes userdefined The type of the machine group identifier. Valid values: ip and userdefined.
    groupAttribute object Yes None The attribute of the machine group. Default value: null.
    machineList array Yes uu_id_1, uu_id_2 The list of machine identifiers, which can be IP addresses or user-defined identifiers.
    The following table describes the attributes in the groupAttribute object.
    Parameter Type Required Example Description
    groupTopic string No testtopic2 The topic of the machine group. Default value: null.
    externalName string No testgroup2 The external management identifier on which the machine group depends. Default value: null.

Response parameters

  • Response headers

    The UpdateMachineGroup API operation does not have operation-specific response headers. For information about common response headers of Log Service API operations, see Common response headers.

  • Response parameters

    The HTTP status code 200 is returned.

Examples

  • Sample requests
    PUT /machinegroups/test-machine-group HTTP/1.1
    Header :
    {
        "x-log-apiversion": "0.6.0",
        "Authorization": "LOG <yourAccessKeyId>:<yourSignature>",
        "Host": "ali-test-project.cn-hangzhou-devcommon-intranet.sls.aliyuncs.com",
        "Date": "Tue, 10 Nov 2015 18:41:43 GMT",
        "Content-Length": "194",
        "x-log-signaturemethod": "hmac-sha1",
        "Content-MD5": "2CEBAEBE53C078891527CB70A855BAF4",
        "User-Agent": "sls-java-sdk-v-0.6.0",
        "Content-Type": "application/json",
        "x-log-bodyrawsize": "0"
    }
    Body :
    {
        "groupName": "test-machine-group",
        "groupType": "",
        "machineIdentifyType": "userdefined",
        "groupAttribute":     {
            "groupTopic": "testtopic2",
            "externalName": "testgroup2"
        },
        "machineList":     [
            "uu_id_1",
            "uu_id_2"
        ]
    }
  • Sample success responses
    HTTP/1.1 200 OK
    Header :
    {
        "Date": "Tue, 10 Nov 2015 18:41:43 GMT",
        "Content-Length": "0",
        "x-log-requestid": "56423A6799248CA57B00035C",
        "Connection": "close",
        "Server": "nginx/1.6.1"
    }

Error codes

HTTP status code Error code Error message Description
404 GroupNotExist group {GroupName} does not exist The error message returned because the specified machine group does not exist.
400 InvalidParameter invalid group resource json The error message returned because a parameter value is invalid.
500 InternalServerError internal server error The error message returned because an internal server error has occurred.

For more information about the error codes, see Common error codes.