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.
OpenTelemetry Go SDK
The OpenTelemetry Go SDK can send logs and traces to Seq. See Ingestion with OpenTelemetry and Tracing from OpenTelemetry for more information.
Updated 4 days ago