sysloggen

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSyslog

func GenerateSyslog(params Params) error

Types

type DelayCfg

type DelayCfg struct {
	MinDelayMS int
	MaxDelayMS int
}

type Params

type Params struct {
	// If TimeLayout is empty, "Jan _2 15:04:05" will be used.
	TimeLayout string

	StartTime     time.Time
	SecondLogTime time.Time

	// LogBasename is a name like "mylog", can be "/path/to/mylog" as well.
	// The first (older) log will have the ".1" appended to it.
	LogBasename string

	// NumLogs specifies the max amount of logs to generate. If 0, we never stop
	// generating logs, and once caught up with the current time (time.Now()), it
	// switches to the real-time mode and continues there forever, waiting for
	// appropriate durations before printing every line.
	NumLogs int

	MinDelayMS int
	MaxDelayMS int

	RandomSeed int

	// SkipIfPrevLogSizeIs and SkipIfLastLogSizeIs are an optimization:
	// if the log files already exist and are of these exact sizes, don't
	// generate anything.
	SkipIfPrevLogSizeIs int64
	SkipIfLastLogSizeIs int64

	Spikes []Spike
}

type Spike

type Spike struct {
	StartTime time.Time
	// All of SyslogParts fields are optional; what is not specified, will be random
	SyslogParts SyslogParts
	Phases      []SpikePhase
}

type SpikePhase

type SpikePhase struct {
	// If EndTime is zero, the phase will never end
	EndTime time.Time

	MinDelayMS int
	MaxDelayMS int

	Trend func(phasePercentage float64, minDelayMS, maxDelayMS int) DelayCfg
}

type SyslogParts

type SyslogParts struct {
	Tag      string
	Severity string
	Pid      int
	Message  string
}

Jump to

Keyboard shortcuts

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