We're launching a new cybersecurity venture! Learn more about Snowbit >

Coralogix Rest API Coralogix Rest API

Last Updated: Apr. 28, 2022

This document includes cluster dependent URL’s. Each URL has a variable part (in Italic). Please match this part with a row entry within the following table. Copy the table row entry located under the column that matches the top level domain of your Coralogix account (.com, .in etc.). Replace the variable part of the URL with this entry.

 Elasticsearch-APISSL CertificatesCluster URL
.comhttps://coralogix-esapi.coralogix.com:9443https://coralogix-public.s3-eu-west-1.amazonaws.com/certificate/Coralogix-EU.crtcoralogix.com
.ushttps://esapi.coralogix.us:9443https://www.amazontrust.com/repository/AmazonRootCA1.pemcoralogix.us
.inhttps://es-api.app.coralogix.in:9443https://coralogix-public.s3-eu-west-1.amazonaws.com/certificate/Coralogix-IN.pemapp.coralogix.in
.eu2.https://es-api.eu2.coralogix.com:9443https://www.amazontrust.com/repository/AmazonRootCA1.pemapp.eu2.coralogix.com
sg.comhttps://es-api.coralogixsg.com:9443https://www.amazontrust.com/repository/AmazonRootCA1.pemapp.coralogixsg.com

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

Schema

Endpoint Details

URLhttps://api.Cluster URL/api/v1/logs
HTTP MethodPOST
Content-Typeapplication/json

*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

RequiredProperty NameProperty TypeNote
YesprivateKeyUUID
YesapplicationNamestringusually used to separate environments
YessubsystemNamestringusually used to separate components
computerNamestring
YeslogEntriesarray of logs

Log

RequiredProperty NameProperty TypeNotes
YestimestampnumberUTC milliseconds since 1970 (supports sub millisecond via a floating point)
Yesseveritynumber1 – Debug, 2 – Verbose, 3 – Info, 4 – Warn, 5 – Error, 6 – Critical
Yestextstring
hiResTimestampstringUTC nanoseconds since 1970
(supports millisecond, microsecond and nanosecond)
classNamestring
methodNamestring
threadIdstring
categorystring

Example

 {
           "privateKey": "",
           "applicationName": "*insert desired application name*",
           "subsystemName": "*insert desired subsystem name*",
           "computerName": "*insert computer name*",
           "logEntries": [
             {
               "timestamp": 1457827957703.342, 
               "hiResTimestamp": "1651066642.123456789", 
               "severity": 4,
               "text": "Encountered an error while registering the user john123",
               "category": "DAL",
               "className": "UserManager",
               "methodName": "RegisterUser",
               "threadId": "a-352"
             },
             { 
               "timestamp": 1457827957703.342,
               "hiResTimestamp": "1651066642.123456789", 
               "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

**It is required to send only one of the following: timestamp or hiResTimestamp. Optionally both can be sent in which case hiResTimestamp takes precedence over timestamp.

Need help? We love to assist our customers, simply reach out via our in-app chat, and we will walk you through, step by step.

On this page