Documentation ¶
Index ¶
Constants ¶
const Version = "v0.6.0"
Version is the semver version of this tool.
Variables ¶
This section is empty.
Functions ¶
func LevelNameOrderStr ¶ added in v0.5.0
func LevelNameOrderStr() string
LevelNameOrderStr returns a string with all the known level names in order in the format "trace < debug < ...".
func LogLevelLess ¶
LogLevelLess returns true iff level1 is less than level2.
Because ECS doesn't mandate a set of log level names for the "log.level" field, nor any specific ordering of those log levels, this is a best effort based on names and ordering from common logging frameworks. If a level name is unknown, this returns false. Level names are considered case-insensitive.
Types ¶
type Formatter ¶
type Formatter interface {
// contains filtered or unexported methods
}
Formatter is the interface for formatting a log record.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer is the class used to drive ECS log rendering (aka pretty printing).
func NewRenderer ¶
func NewRenderer(shouldColorize, colorScheme, formatName string, maxLineLen int, excludeFields, includeFields []string, ecsLenient, timestampShowDiff bool) (*Renderer, error)
NewRenderer returns a new ECS logging log renderer.
- `shouldColorize` is one of "auto" (meaning colorize if the output stream is a TTY), "yes", or "no"
- `colorScheme` is the name of one of the colors schemes in ansipainter.PainterFromName
- `maxLineLen` a maximum number of bytes for a line that will be considered for log record processing. It must be a positive number between 1 and 1048576 (2^20), or -1 to use the default value (16384).
- `ecsLenient` is a bool indicating if rendering should be lenient in validating if a JSON line is an ecs-logging record. Strictly (the default) to be an ecs-logging record it must have ecs.version, log.level, and @timestamp. If this option is true, it will only require *one* of those fields to exist.
- `timestampShowDiff` is a bool indicating if the @timestamp diff from the preceding log record should be styled.
func (*Renderer) RenderFile ¶
RenderFile renders log records from the given open file stream to the given output stream (typically os.Stdout).
func (*Renderer) SetKQLFilter ¶
SetKQLFilter sets the KQL statement used for log record filtering.
func (*Renderer) SetLevelFilter ¶
SetLevelFilter sets the level at which `log.level` filtering is done.
func (*Renderer) SetStrictFilter ¶ added in v0.2.0
SetStrictFilter tells the renderer whether to strictly suppress input lines that are not valid ecs-logging records.