Our next-gen architecture is built to help you make sense of your ever-growing data Watch a 4-min demo video!

Back to All Integrations

Go Go

Last Updated: Mar. 30, 2022

Coralogix provides Go SDK for your Go applications.

Installation

You need to install go-coralogix-sdk package as any other external package:

go install github.com/coralogix/go-coralogix-sdk

After the installation you can import the package:

import (
    coralogix "github.com/coralogix/go-coralogix-sdk"
)

If your Coralogix account top level domain is different than ‘.com’ add the following environment variables:

CORALOGIX_LOG_URL=https://api.CLUSTER_URL:443/api/v1/logs
CORALOGIX_TIME_DELTA_URL=https://api.CLUSTER_URL:443/sdk/v1/time

Based on the table:

 Cluster URLTeam URL
EUcoralogix.com.coralogix.com
INapp.coralogix.in.app.coralogix.in
USAcoralogix.us.app.coralogix.us
EU2eu2.coralogix.com.app.eu2.coralogix.com
SGcoralogixsg.com.app.coralogixsg.com

Example for India (IN) cluster:
CORALOGIX_LOG_URL=https://api.app.coralogix.in:443/api/v1/logs
CORALOGIX_TIME_DELTA_URL=https://api.app.coralogix.in:443/sdk/v1/time

The simple code example:

package main

import (
    coralogix "github.com/coralogix/go-coralogix-sdk"
)

func main() {
    coralogix.SetDebug(true)

    logger := coralogix.NewCoralogixLogger(
        "YOUR_PRIVATE_KEY_HERE",
        "YOUR_APPLICATION_NAME",
        "YOUR_SUBSYSTEM_NAME",
    )
    defer logger.Destroy()

    logger.Debug("Test message 1")
    logger.Info(map[string]string{
        "text":  "Test message 2",
        "extra": "additional",
    })
    logger.Warning("Test message 4")
}

You can find more information about the go-coralogix-sdk package:

On this page