journal

package
v1.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package journal writes entries to the local systemd journal over its native protocol.

The protocol is a datagram of "FIELD=value" lines sent to a Unix socket. A value containing a newline cannot be written that way, so it is sent as the field name on its own line, the value's length as a little-endian uint64, and then the value. A datagram too large for the socket buffer is instead written to an unlinked file whose descriptor is passed to journald out of band.

See https://systemd.io/JOURNAL_NATIVE_PROTOCOL/ and https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled

func Enabled() bool

Enabled reports whether the local journal is available to write to.

func Send

func Send(message string, priority Priority, variables map[string]string) error

Send writes one entry to the journal. Field names in variables must satisfy journald's rules; see validateFieldName. variables may be nil.

Types

type Priority

type Priority int

Priority is the syslog severity an entry is recorded with.

const (
	PriorityEmergency Priority = iota
	PriorityAlert
	PriorityCritical
	PriorityError
	PriorityWarning
	PriorityNotice
	PriorityInfo
	PriorityDebug
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL