Documentation
¶
Overview ¶
Package logsource gives a single, filtered view over every log lerd can reach: framework application log files, PHP-FPM/nginx/dns/service container stdout, and worker/watcher/ui units (systemd journal on Linux, launchd log files on macOS). It wraps the existing readers (internal/applog, podman logs, journalctl) behind one Source registry + Read dispatcher so callers — the MCP `logs` tool, the `diag.logs` alias — never reimplement log access.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FPMContainer ¶
FPMContainer resolves the container that serves a site: its own custom / FrankenPHP / custom-FPM container when applicable, otherwise the shared lerd-php<version>-fpm. Returns "" for host-proxy sites, which run no container. Mirrors cli.resolveWorkerFPMUnit so logs target the same place workers exec into.
Types ¶
type Entry ¶
type Entry struct {
Time string `json:"time,omitempty"`
Level string `json:"level,omitempty"`
Channel string `json:"channel,omitempty"`
Text string `json:"text"`
}
Entry is one normalised log line. Time/Level/Channel are populated when the backend exposes them (monolog files, journal); container stdout fills Text only.
type Opts ¶
type Opts struct {
Since string // relative ("15m", "2h30m"), absolute timestamp, or a prior Cursor
Until string // upper time bound (same formats)
Grep string // regex, falling back to a literal substring when it won't compile
Lines int // tail cap (default 50)
Level string // KindFile/monolog only: error, warning, info, debug…
}
Opts are the filters applied to a fetch. Empty fields are ignored.
type Result ¶
Result is a window of entries in chronological order (oldest first, newest last). Cursor is the newest entry's opaque position — pass it back as Opts.Since on the next call to fetch only newer lines.
type Source ¶
type Source struct {
Name string
Kind Kind
Locator string
Scope Scope
Format string // "monolog"|"raw" for KindFile, empty otherwise
Label string
}
Source is one addressable log stream. Locator is a file path (KindFile), a container name (KindPodman), or a unit name (KindJournal).
func Resolve ¶
Resolve looks up a single source by name within the current context. It resolves the deterministic names (fpm, worker:*, globals) directly so a fetch doesn't pay for a full Sources() enumeration (framework resolution, log-file globbing, installed-PHP discovery); only app:* files and the unknown-name error path fall back to the full listing.