- Print
- PDF
Set server log collection
- Print
- PDF
Available in Classic and VPC
Set log collection for a server in the Classic environment. After completing the log collection settings, you need to install the log collection agent on the server.
You can't collect logs through Cloud Log Analytics without installing the log collection agent. See Install server log collection agent for how to install the log collection agent.
Request
This section describes the request format. The method and URI are as follows:
Method | URI |
---|---|
POST | /api/{regionCode}-v1/classic/servers/collecting-infos |
Request headers
For information about the headers common to all Cloud Log Analytics APIs, see Cloud Log Analytics request headers.
Request path parameters
You can use the following path parameters with your request:
Field | Type | Required | Description |
---|---|---|---|
regionCode | String | Required | Region code
|
Request body
You can include the following data in the body of your request:
Field | Type | Required | Description |
---|---|---|---|
collectingInfos | Array | Required | Set log collection |
collectingInfos
The following describes collectingInfos
.
Field | Type | Required | Description |
---|---|---|---|
logPath | String | Required | Path of log to collect
|
logTemplate | String | Required | Template of log to collect
|
logType | String | Required | Type of log to collect
|
servername | String | Required | Log collection target server name
|
osType | String | Required | Log collection target server operating system
|
instanceNo | Integer | Required | Log collection target server instance number
|
ip | String | Required | Log collection target server IP address
|
Request example
The request example is as follows:
curl --location --request POST 'https://cloudloganalytics.apigw.ntruss.com/api/{regionCode}-v1/classic/servers/collecting-infos' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--header 'Accept: application/json' \
--data '{
"collectingInfos": [
{
"logPath": "/var/log/messages",
"logTemplate": "SYSLOG",
"logType": "SYSLOG",
"servername": "s1933b2316e4",
"osType": "CentOS 7.3 (64-bit)",
"ip": "***.***.***.***",
"instanceNo": 27231808
}
]
}'
Response
This section describes the response format.
Response body
The response body includes the following data:
Field | Type | Required | Description |
---|---|---|---|
code | Integer | - | Response status codes |
message | String | - | Response status message |
result | Object | - | Response result |
result.configKey | String | - | Log collection agent install key |
result.usage | String | - | Log collection agent installation command |
Response status codes
For response status codes common to all Cloud Log Analytics APIs, see Cloud Log Analytics response status codes.
Response example
The response example is as follows:
{
"code": 0,
"message": "The request has been successfully processed.",
"result": {
"configKey": "*********",
"usage": "curl -s http://cm.cla.ncloud.com/setUpCla/********* | sudo sh"
}
}