Using the HTTP SDK
- Print
- PDF
Using the HTTP SDK
- Print
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
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
Parameters | Type | Required | Description |
---|---|---|---|
projectName | string | required | Project ID. For more information on how to check project ID, see search 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, hyphen (-), period (.), and underline (_) |
body | string | required | Log message. Uses UTF-8 and does not allow empty 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 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?