Using the HTTP SDK
    • PDF

    Using the HTTP SDK

    • PDF

    Article Summary

    Available in Classic and VPC

    Overview

    You can send logs to Effective Log Search & Analytics using HTTPS protocol, and uses JSON format as follows:

    {
        "projectName": "72356c50401b8e20_testproject",
        "projectVersion": "1.0.0",
        "body": "This log message come from HTTPS client.",
        "logLevel": "DEBUG",
        "logType": "WEB",
        "logSource": "https"
    }
    

    Parameters

    ParametersTypeRequiredDescription
    projectNamestringrequiredProject ID. For more information on how to check project ID, see search project.
    projectVersionstringrequiredProject version. The default value is 1.0.0 and can only include characters such as upper and lower case A to Z, 0 to 9, hyphen (-), period (.), and underline (_)
    bodystringrequiredLog message. Uses UTF-8 and does not allow empty spaces
    logSourcestringoptionalUses to identify logs, and the default value is "json" when it is not sent.
    logTypestringoptionalUses to identify logs, and the default value is "nelo2-log" when it is not sent.

    Caution

    The follow address must be used when sending logs to Effective Log Search & Analytics using JSON or HTTPS.

    https://elsa-col.ncloud.com/_store
    

    "logTime" and "sendTime" is used in Effective Log Search & Analytics system. When both keys are used, it is ignored in Effective Log Search & Analytics.

    PUT and POST method is only supported when sending HTTPS logs.

    Log transfer examples

    Case of transferring a log normally using curl

    Transferring logs using POST method

    $ curl -XPOST 'https://elsa-col.ncloud.com/_store' -d '{
        "projectName": "%YOUR_PROJECT_ID%",
        "projectVersion": "1.0.0",
        "body": "this log message come from https client, and it is a simple sample.",
    	"logLevel": "DEBUG",
    	"logType": "WEB",
    	"logSource": "https"
    }'
    

    Transferring log using PUT method

    $ curl -XPUT 'https://elsa-col.ncloud.com/_store' -d '{
        "projectName": "%YOUR_PROJECT_ID%",
        "projectVersion": "1.0.0",
        "body": "this log message come from https client, and it is a simple sample.",
    	"logLevel": "DEBUG",
    	"logType": "WEB",
    	"logSource": "https"
    }'
    

    Case of failing to transfer log

    Invalid URL (_storess -> _store)

    $ curl -XPOST 'https://elsa-col.ncloud.com/_storess' -d '{
        "projectName": "%YOUR_PROJECT_ID%",
        "projectVersion": "1.0.0",
        "body": "this log message come from https client, and it is a simple sample.",
        "_xxx": "this is a invalid key"
    }'
    

    Invalid field key (_xxx)

    $ curl -XPOST 'https://elsa-col.ncloud.com/_store' -d '{
        "projectName": "%YOUR_PROJECT_ID%",
        "projectVersion": "1.0.0",
        "body": "this log message come from https client, and it is a simple sample.",
        "_xxx": "this is a invalid key"
        }'
    

    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.