Set server log collection
    • PDF

    Set server log collection

    • PDF

    Article summary

    Available in Classic and VPC

    Set log collection for a server in the VPC environment. After completing the log collection settings, you need to install the log collection agent on the server.

    Note

    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:

    MethodURI
    POST/api/{regionCode}-v1/vpc/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:

    FieldTypeRequiredDescription
    regionCodeStringRequiredRegion code
    • kr | sgn | jpn
      • kr: Korea Region
      • sgn: Singapore Region
      • jpn: Japan Region

    Request body

    You can include the following data in the body of your request:

    FieldTypeRequiredDescription
    collectingInfosArrayRequiredSet log collection

    collectingInfos

    The following describes collectingInfos.

    FieldTypeRequiredDescription
    logPathStringRequiredPath of log to collect
    • See the Management menu of the Cloud Log Analytics console
    • <e.g.>/var/log/messages, /var/log/secure*
    logTemplateStringRequiredTemplate of log to collect
    • See the Management menu of the Cloud Log Analytics console
    • <e.g.>APACHE, TOMCAT
    logTypeStringRequiredType of log to collect
    • See the Management menu of the Cloud Log Analytics console
    • <e.g.>SYSLOG, security_log
    servernameStringRequiredLog collection target server name
    osTypeStringRequiredLog collection target server operating system
    instanceNoIntegerRequiredLog collection target server instance number
    ipStringOptionalLog collection target server IP address
    macAddrStringRequiredLog collection target server MAC address

    Request example

    The request example is as follows:

    curl --location --request POST 'https://cloudloganalytics.apigw.ntruss.com/api/{regionCode}-v1/vpc/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": "s19293c276d5",
                "osType": "centos-7.3-64",
                "ip": "***.***.***.***",
                "instanceNo": 27056413,
                "macAddr":  "**:**:**:**:**:**"
                }
          ]
    }'
    

    Response

    This section describes the response format.

    Response body

    The response body includes the following data:

    FieldTypeRequiredDescription
    codeInteger-Response status codes
    messageString-Response status message
    resultObject-Response result
    result.configKeyString-Log collection agent install key
    result.usageString-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.vcla.ncloud.com/setUpClaVPC/********* | sudo sh"
        }
    }
    

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.