waflog

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 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.FTWConfiguration) (*FTWLogLines, error)

NewFTWLogLines is the base struct for reading the log file

func (*FTWLogLines) CheckLogForMarker

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

CheckLogForMarker reads the log file and searches for a marker line. stageID is the ID of the current stage, 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 added in v1.0.0

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 added in v1.0.0

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 added in v1.0.0

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 added in v1.0.0

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

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

func (*FTWLogLines) WithEndMarker added in v0.4.5

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

WithEndMarker sets the end marker for the log file

func (*FTWLogLines) WithStartMarker added in v0.4.5

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