Log Server Operations
AddLogConfiguration
API Request
URLs
POST zstack/v1/log/configurationsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"name": "syslog",
"type": "log4j2",
"configuration": "{\n\"appenderType\": \"Syslog\",\n\"configuration\": {\n\"hostname\": \"192.168.0.11\",\n\"port\": \"514\",\n\"protocol\": \"UDP\",\n\"facility\": \"LOCAL5\"\n}\n}"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"syslog","type":"log4j2","configuration":"{\n\"appenderType\": \"Syslog\",\n\"configuration\": {\n\"hostname\": \"192.168.0.11\",\n\"port\": \"514\",\n\"protocol\": \"UDP\",\n\"facility\": \"LOCAL5\"\n}\n}"}}' http://localhost:8080/zstack/v1/log/configurationsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The resource name. | 3.10.0 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 3.10.0 | |
| type | String | body (contained in the params structure) | 3.10.0 | ||
| configuration | String | body (contained in the params structure) | 3.10.0 | ||
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. | 3.10.0 | |
| tagUuids | List | body (contained in the params structure) | Optional. The tag UUID list. | 3.10.0 | |
| systemTags | List | body | Optional. The system tags. | 3.10.0 | |
| userTags | List | body | Optional. The user tags. | 3.10.0 |
API Response
Sample
Response
{
"inventory": {
"id": 0.0,
"labelKey": "log4j2-f2828a4c39af4605a86a94a36b8f7865",
"labelValue": "{\n\"appenderType\": \"Syslog\",\n\"configuration\": {\n\"hostname\": \"192.168.0.11\",\n\"port\": \"514\",\n\"protocol\": \"UDP\",\n\"facility\": \"LOCAL5\"\n}\n}"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.10.0 |
| inventory | ResourceStackInventory | See inventory. | 3.10.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 3.10.0 |
| description | String | The brief description of the error. | 3.10.0 |
| details | String | The details about the error. | 3.10.0 |
| elaboration | String | The reserved field. Default value: null. | 3.10.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.10.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.10.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.10.0 | |
| labelKey | String | 3.10.0 | |
| labelValue | String | 3.10.0 | |
| resourceUuid | String | The resource UUID. | 3.10.0 |
| createDate | Timestamp | The creation date. | 3.10.0 |
| lastOpDate | Timestamp | The last operation date. | 3.10.0 |
SDK Sample
Java
SDK
AddLogConfigurationAction action = new AddLogConfigurationAction();
action.name = "syslog";
action.type = "log4j2";
action.configuration = "{
"appenderType": "Syslog",
"configuration": {
"hostname": "192.168.0.11",
"port": "514",
"protocol": "UDP",
"facility": "LOCAL5"
}
}";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddLogConfigurationAction.Result res = action.call();Python
SDK
AddLogConfigurationAction action = AddLogConfigurationAction()
action.name = "syslog"
action.type = "log4j2"
action.configuration = "{
"appenderType": "Syslog",
"configuration": {
"hostname": "192.168.0.11",
"port": "514",
"protocol": "UDP",
"facility": "LOCAL5"
}
}"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddLogConfigurationAction.Result res = action.call()DeleteLogConfiguration
API Request
URLs
DELETE zstack/v1/log/configurations/log4j2Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/log/configurations/log4j2?deleteMode=PermissiveRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| configId | Long | body | The configuration ID. | 3.10.0 | |
| deleteMode | String | body | Optional. The delete mode. Options: Enforcing | Permissive. Default value: Permissive. |
|
3.10.0 |
| systemTags | List | body | Optional. The system tags. | 3.10.0 | |
| userTags | List | body | Optional. The user tags. | 3.10.0 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes an error field. For
example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
Java
SDK
DeleteLogConfigurationAction action = new DeleteLogConfigurationAction();
action.configId = 0.0;
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteLogConfigurationAction.Result res = action.call();Python
SDK
DeleteLogConfigurationAction action = DeleteLogConfigurationAction()
action.configId = 0.0
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteLogConfigurationAction.Result res = action.call()GetLogConfiguration
API Request
URLs
GET zstack/v1/log/configurationsHeaders
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" -X GET http://localhost:8080/zstack/v1/log/configurationsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| systemTags | List | query | Optional. The system tags. | 3.10.0 | |
| userTags | List | query | Optional. The user tags. | 3.10.0 |
API Response
Sample
Response
{
"inventories": [
{
"id": 0.0,
"labelKey": "log4j2-0201c1784c6e48d2ba26954d4c688fae",
"labelValue": "{\n\"appenderType\": \"Syslog\",\n\"configuration\": {\n\"hostname\": \"192.168.0.13\",\n\"port\": \"514\",\n\"protocol\": \"UDP\",\n\"facility\": \"LOCAL5\"\n}\n}"
},
{
"id": 0.0,
"labelKey": "log4j2-ba2cf0a6945d4267bfdc1994776b509d",
"labelValue": "{\n\"appenderType\": \"Syslog\",\n\"configuration\": {\n\"hostname\": \"192.168.0.11\",\n\"port\": \"514\",\n\"protocol\": \"UDP\",\n\"facility\": \"LOCAL5\"\n}\n}"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.10.0 |
| inventories | List | See inventories. | 3.10.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 3.10.0 |
| description | String | The brief description of the error. | 3.10.0 |
| details | String | The details about the error. | 3.10.0 |
| elaboration | String | The reserved field. Default value: null. | 3.10.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.10.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.10.0 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.10.0 | |
| labelKey | String | 3.10.0 | |
| labelValue | String | 3.10.0 | |
| resourceUuid | String | The resource UUID. | 3.10.0 |
| createDate | Timestamp | The creation date. | 3.10.0 |
| lastOpDate | Timestamp | The last operation date. | 3.10.0 |
SDK Sample
Java
SDK
GetLogConfigurationAction action = new GetLogConfigurationAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetLogConfigurationAction.Result res = action.call();Python
SDK
GetLogConfigurationAction action = GetLogConfigurationAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetLogConfigurationAction.Result res = action.call()UpdateLogConfiguration
API Request
URLs
PUT zstack/v1/log/configurationsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"updateLogConfiguration": {
"configId": 1.0
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateLogConfiguration":{"configId":1.0}}' http://localhost:8080/zstack/v1/log/configurationsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| configId | long | body (contained in the updateLogConfiguration structure) | The configuration ID. | 3.10.0 | |
| name | String | body (contained in the updateLogConfiguration structure) | Optional. The resource name. | 3.10.0 | |
| description | String | body (contained in the updateLogConfiguration structure) | Optional. The detailed description of the resource. | 3.10.0 | |
| systemTags | List | body | Optional. The system tags. | 3.10.0 | |
| userTags | List | body | Optional. The user tags. | 3.10.0 |
API Response
Sample
Response
{
"inventory": {
"id": 0.0,
"labelKey": "log4j2-848dd6e5712e4227ae40447753871ba8",
"labelValue": "{\n\"appenderType\": \"Syslog\",\n\"configuration\": {\n\"hostname\": \"192.168.0.11\",\n\"port\": \"514\",\n\"protocol\": \"UDP\",\n\"facility\": \"LOCAL5\"\n}\n}"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.10.0 |
| inventory | VmNicInventory | See inventory. | 3.10.0 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 3.10.0 |
| description | String | The brief description of the error. | 3.10.0 |
| details | String | The details about the error. | 3.10.0 |
| elaboration | String | The reserved field. Default value: null. | 3.10.0 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 3.10.0 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 3.10.0 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| id | long | 3.10.0 | |
| labelKey | String | 3.10.0 | |
| labelValue | String | 3.10.0 | |
| resourceUuid | String | The resource UUID. | 3.10.0 |
| createDate | Timestamp | The creation date. | 3.10.0 |
| lastOpDate | Timestamp | The last operation date. | 3.10.0 |
SDK Sample
Java
SDK
UpdateLogConfigurationAction action = new UpdateLogConfigurationAction();
action.configId = 1.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateLogConfigurationAction.Result res = action.call();Python
SDK
UpdateLogConfigurationAction action = UpdateLogConfigurationAction()
action.configId = 1.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateLogConfigurationAction.Result res = action.call()