Documentation
DocumentationDiscussions
Documentation

Logging from Go

Seq can accept logs from Go programs via GELF or directly from Logrus with Logruseq.

GELF

📘

Before sending events to Seq using GELF, the GELF input must be enabled.

The Graylog2/go-gelf package can be used to send events from the application as GELF messages using the standard log package:

package main

import (
    "gopkg.in/Graylog2/go-gelf.v2/gelf"
    "log"
)

func main() {
    var logger, err = gelf.NewUDPWriter("seq-server-uri:12201")

    if err != nil {
        log.Fatalf("Failed to create UDP writer: %s", err)
    }

    // Don't prefix messages with a redundant timestamp etc.
    log.SetFlags(0)
    
    log.SetOutput(logger)

    log.Print("Hello, from go!")
}

Logrus

For Logrus setup, see the documentation for Logruseq.