Coralogix rest API
Yoni Farin avatar
Written by Yoni Farin
Updated over a week ago

Coralogix exposes an API that allows you to send your logs from basically anywhere, here is how:

Schema

Endpoint Details:

URL

https://api.Cluster URL/api/v1/logs

HTTP Method

POST

Content-Type

application/json

Account Url Ending with .us

Account Url Ending with .com

Account Url Ending with .in

api.coralogix.us

api.coralogix.com

api.app.coralogix.in

*We recommend sending logs in "bulks" or "batches" to minimize network calls.

**If you are using Ajax (or similar technology) you might need to send the data with JSON.stringify())

You can group logs from the same application, subsystem, and computer under a single API call using the "logEntries" property.

Note that the API is limited to a message size of 2MB which is approximately 3000 medium-sized logs.

POST Body

Log

Coralogix rest API implementation Example:

        {
           "privateKey": "",
           "applicationName": "*insert desired application name*",
           "subsystemName": "*insert desired subsystem name*",
           "computerName": "*insert computer name*",
           "logEntries": [
             {
               "timestamp": 1457827957703.342,
               "severity": 4,
               "text": "Encountered an error while registering the user john123",
               "category": "DAL",
               "className": "UserManager",
               "methodName": "RegisterUser",
               "threadId": "a-352"
             },
             {
               "timestamp": 1457827957703.342,
               "severity": 3,
               "text": "{\"key1\":\"val1\",\"key2\":\"val2\",\"key3\":\"val3\",\"key4\":\"val4\"}",
               "category": "DAL",
               "className": "UserManager",
               "methodName": "RegisterUser",
               "threadId": "a-352"
             }
           ]
        }

** If you are sending a JSON payload note that you should escape it like in the above example and then insert it into the text field (text field should be sent as string)

** Make sure you use UTC time in milliseconds

 

Did this answer your question?