waflog

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package waflog encapsulates getting logs from a WAF to compare with expected results

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FTWLogLines

type FTWLogLines struct {
	LogMarkerHeaderName []byte
	// contains filtered or unexported fields
}

FTWLogLines represents the filename to search for logs in a certain timespan

func NewFTWLogLines

func NewFTWLogLines(cfg *config.RunnerConfig) (*FTWLogLines, error)

NewFTWLogLines is the base struct for reading the log file

func (*FTWLogLines) CheckLogForMarker

func (ll *FTWLogLines) CheckLogForMarker(markerId string, readLimit uint) []byte

CheckLogForMarker reads the log file and searches for a marker line. markerId is the ID of the current stage + suffix (for start / end), which is part of the marker line readLimit is the maximum numbers of lines to check

func (*FTWLogLines) Cleanup

func (ll *FTWLogLines) Cleanup() error

Cleanup closes the log file

func (*FTWLogLines) ContainsAllIds

func (ll *FTWLogLines) ContainsAllIds(ids []uint) (bool, []uint)

ContainsAllIds returns true if all of the specified rule IDs appear in the log for the current test. The IDs of all the IDs that were *not* found will be the second return value.

func (*FTWLogLines) ContainsAnyId

func (ll *FTWLogLines) ContainsAnyId(ids []uint) (bool, []uint)

ContainsAnyId returns true if at least one of the specified IDs appears in the log for the current test. The IDs of all the IDs that were found will be the second return value.

func (*FTWLogLines) EndMarker

func (ll *FTWLogLines) EndMarker() []byte

func (*FTWLogLines) MatchesRegex

func (ll *FTWLogLines) MatchesRegex(pattern string) bool

MatchesRegex returns true if the regular expression pattern matches any of the lines in the log for the current test

func (*FTWLogLines) StartMarker

func (ll *FTWLogLines) StartMarker() []byte

func (*FTWLogLines) TriggeredRules

func (ll *FTWLogLines) TriggeredRules() []uint

TriggeredRules returns the IDs of all the rules found in the log for the current test

func (*FTWLogLines) WithEndMarker

func (ll *FTWLogLines) WithEndMarker(marker []byte)

WithEndMarker sets the end marker for the log file

func (*FTWLogLines) WithStartMarker

func (ll *FTWLogLines) WithStartMarker(marker []byte)

WithStartMarker resets the internal state of the log file checker and sets the start marker for the log file

Jump to

Keyboard shortcuts

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