Skip to content

Go

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"
)

Input your Coralogix domain in the following URLs:

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

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

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")
}

Additional Resources

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

Support

Need help?

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us via our in-app chat or by sending us an email at [email protected].