Documentation
¶
Overview ¶
Package waflog encapsulates getting logs from a WAF to compare with expected results
Index ¶
- type FTWLogLines
- func (ll *FTWLogLines) CheckLogForMarker(markerId string, readLimit uint) []byte
- func (ll *FTWLogLines) Cleanup() error
- func (ll *FTWLogLines) ContainsAllIds(ids []uint) (bool, []uint)
- func (ll *FTWLogLines) ContainsAnyId(ids []uint) (bool, []uint)
- func (ll *FTWLogLines) EndMarker() []byte
- func (ll *FTWLogLines) MatchesRegex(pattern string) bool
- func (ll *FTWLogLines) StartMarker() []byte
- func (ll *FTWLogLines) TriggeredRules() []uint
- func (ll *FTWLogLines) WithEndMarker(marker []byte)
- func (ll *FTWLogLines) WithStartMarker(marker []byte)
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) 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