logparse

package
v0.0.0-...-b973d07 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logparse turns algod node.log lines into counts, templates and events. A byte-level prefilter handles the known noisy lines without decoding JSON: agreement trace lines, transaction pool floods and HTTP access lines. The rest become message templates, and specific extractors turn known lines into events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Template

func Template(msg string) string

Template replaces the variable parts of a message with placeholders: addresses, numbers, base32 IDs, hashes, durations, peer IDs, multiaddrs, IP addresses, host names with a port and hex. Messages that differ only in those parts share a template.

Types

type Extract

type Extract struct {
	Type     string // connect, disconnect, conn-reset, handshake-eof, gossip-stream, outgoing, incoming, catchup-start, catchup-end, closed-account, panic, fatal, ledger-error
	Addr     string // the peer, or for closed-account the account
	Incoming bool
	Reason   string
	Delay    int64 // MessageDelay, ns
	PeerID   string
	Protocol string
	Message  string
	Remote   string
	IP       string // the remote IP when Addr is a host name
}

Extract is a structured event pulled from a known line.

type Kind

type Kind int

Kind of a parsed line.

const (
	KindTrace Kind = iota + 1
	KindFlood
	KindHTTP
	KindTemplate
	KindBad
)

Line kinds.

type Line

type Line struct {
	Kind      Kind
	Time      time.Time
	Level     string // info, warning, error, ...
	Template  string
	Msg       string
	TraceType string // agreement message type for trace lines
	AppID     string // app for pool-flood lines, "" if none
	HTTPPath  string
	HTTPCode  string
	Self      bool // a request algodtop made, from algod's request log
	Extract   *Extract
	Round     uint64 // for BlockAccepted / RoundConcluded
}

Line is one parsed log line.

func Parse

func Parse(b []byte) Line

Parse classifies one line. It decodes JSON only for lines that survive the prefilter.

Jump to

Keyboard shortcuts

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