Go SDK (BETA)

Official Go SDK for communicating with the LogFlux agent via Unix socket or TCP

Go Logo

BETA SOFTWARE: This SDK is feature-complete for basic logging use cases but is marked as BETA while we gather community feedback and add additional features. The API is stable but may evolve based on user needs.

A lightweight Go SDK for communicating with the LogFlux agent’s local server via Unix socket or TCP protocols.

Complete documentation and examples on GitHub →

Key Features

  • Multiple transport protocols: Unix socket (default), TCP
  • Automatic batching: Configurable batch sizes and flush intervals
  • Authentication support: TCP shared secret authentication
  • Retry logic: Built-in connection retry with exponential backoff
  • Type safety: Strongly typed log entries and configuration

Built-in Logger Integrations

Integrations and adapters for popular Go logging libraries:

  • logrus - Structured logger adapter
  • zap - Ultra-fast logger integration
  • zerolog - Zero allocation JSON logger
  • slog - Go 1.21+ structured logging
  • standard log - Built-in Go logger replacement

Installation

1
go get github.com/logflux-io/logflux-go-sdk

Quick Start

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import (
    "context"
    "github.com/logflux-io/logflux-go-sdk/pkg/client"
    "github.com/logflux-io/logflux-go-sdk/pkg/types"
)

// Create client and send log
c := client.NewUnixClient("/tmp/logflux-agent.sock")
ctx := context.Background()
c.Connect(ctx)
defer c.Close()

entry := types.NewLogEntry("Hello, LogFlux!", "my-app").WithLogLevel(types.LevelInfo)
c.SendLogEntry(entry)

Current Status

  • Stable API for core logging functionality
  • Production quality code and testing
  • Ready for evaluation and non-critical use cases
  • Additional features (metrics, traces, events) coming soon

Requirements

  • Go: 1.21 or later
  • LogFlux Agent: Required for SDK operation

Support

Disclaimer

The Go logo and trademarks are the property of Google LLC. LogFlux is not affiliated with, endorsed by, or sponsored by Google LLC. The Go logo is used solely for identification purposes to indicate compatibility and integration capabilities.