How to use HTTP SDK

Prev Next

Available in Classic and VPC

Overview

You can send logs to Effective Log Search & Analytics using the HTTPS protocol, with the 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"
}

Parameter

Parameter Type Required Description
projectName string required Project ID. For more information on how to check project ID, see View project.
projectVersion string required Project 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, hyphens (-), periods (.), and underscores (_).
body string required Log message. Uses UTF-8 and does not allow spaces.
logSource string optional Uses to identify logs, and the default value is "json" when it is not sent.
logType string optional Uses to identify logs, and the default value is "nelo2-log" when it is not sent.

Caution

The following 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" are used in Effective Log Search & Analytics system. When both keys are used, it is ignored in Effective Log Search & Analytics.

HTTPS log transfer supports only the PUT and POST methods.

Log transfer examples

When a log is successfully sent using curl

Log transfer using the POST method

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

Log transfer using the PUT method

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

When log transfer fails

Invalid URL (_storess → _store)

$ curl -XPOST 'https://elsa-col.ncloud.com/_storess' -d '{
    "projectName": "%YOUR_PROJECT_KEY%",
    "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_KEY%",
    "projectVersion": "1.0.0",
    "body": "this log message come from https client, and it is a simple sample.",
    "_xxx": "this is a invalid key"
    }'