zeek

package
v0.0.0-...-88a36fa Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RegisteredTSVFileTypes []TSVFileType

RegisteredTSVFileTypes is initialized with the supported Zeek file types when the zeek package is imported See conn.go and dns.go.

Functions

func CreateRollingWritingSystem

func CreateRollingWritingSystem(fs afero.Fs, clock clock.Clock, tgtDir string, crashFunc func()) (output.ECSWriter, error)

CreateRollingWritingSystem constructs new rolling writer system

func CreateStandardWritingSystem

func CreateStandardWritingSystem(fs afero.Fs, clock clock.Clock, tgtDir string) (output.ECSWriter, error)

CreateStandardWritingSystem Creates a single shot writer system

func FormatTSVClose

func FormatTSVClose(header TSVHeader, closeTime time.Time) string

FormatTSVClose returns the close footer that is included at the end of each Zeek TSV file

func MapECSRecordsToTSVFiles

func MapECSRecordsToTSVFiles(ecsRecords []input.ECSRecord) map[TSVFileType][]input.ECSRecord

MapECSRecordsToTSVFiles maps the given Elastic Common Schema records to the Zeek files that they should be written to

func OpenTSVFile

func OpenTSVFile(fs afero.Fs, clock clock.Clock, fileType TSVFileType, filePath string) (file afero.File, err error)

OpenTSVFile opens a Zeek TSV file at the given file path. If the file does not exist, this function creates the file and writes out the appropriate Zeek TSV header as described by the given Zeek file type.

func WriteTSVFooter

func WriteTSVFooter(fileType TSVFileType, closeTime time.Time, fileWriter io.Writer) error

WriteTSVFooter writes out the footer for a Zeek TSV file of the given type

func WriteTSVHeader

func WriteTSVHeader(fileType TSVFileType, openTime time.Time, fileWriter io.Writer) error

WriteTSVHeader writes out the header for a newly opened Zeek TSV file of the given type

func WriteTSVLines

func WriteTSVLines(fileType TSVFileType, outputData []input.ECSRecord, fileWriter io.Writer) error

WriteTSVLines writes out Elastic Common Schema records as lines of the given Zeek TSV file type to the given writer

Types

type ConnTSV

type ConnTSV struct{}

func (ConnTSV) FormatLines

func (c ConnTSV) FormatLines(outputData []input.ECSRecord) (output string, err error)

func (ConnTSV) HandlesECSRecord

func (c ConnTSV) HandlesECSRecord(data input.ECSRecord) bool

func (ConnTSV) Header

func (c ConnTSV) Header() TSVHeader

type DnsTSV

type DnsTSV struct{}

func (DnsTSV) FormatLines

func (c DnsTSV) FormatLines(outputData []input.ECSRecord) (output string, err error)

func (DnsTSV) HandlesECSRecord

func (c DnsTSV) HandlesECSRecord(data input.ECSRecord) bool

func (DnsTSV) Header

func (c DnsTSV) Header() TSVHeader

type RollingWriter

type RollingWriter struct {
	// contains filtered or unexported fields
}

RollingWriter is our continuous writer, expects packet sessions in and will print to a spool file until the end of the hour and will rotate them

func (*RollingWriter) Close

func (w *RollingWriter) Close() error

Close will close out the file progress and save everything from spool to main log output

func (*RollingWriter) WriteECSRecords

func (w *RollingWriter) WriteECSRecords(outputData []input.ECSRecord) error

WriteECSRecords writes Elastic Common Schema records out to Zeek files

type StandardWriter

type StandardWriter struct {
	// contains filtered or unexported fields
}

StandardWriter is our standard, single output file, will first write everything to single spool then move them to an appropriate, time stamped log file

func (*StandardWriter) Close

func (w *StandardWriter) Close() error

Close will close all open sessions and rotate everything from spool data to logs

func (*StandardWriter) WriteECSRecords

func (w *StandardWriter) WriteECSRecords(outputData []input.ECSRecord) error

WriteECSRecords writes Elastic Common Schema records out to Zeek files

type TSVFileType

type TSVFileType interface {
	//Header returns a ZeekHeader struct detailing the format of this Zeek TSV file type
	Header() TSVHeader
	//FormatLines formats Elastic Common Schema records as lines of this Zeek TSV file type
	FormatLines(outputData []input.ECSRecord) (output string, err error)
	//HandlesECSRecord turns true if the data in the given ECS record can be formatted as a line of this Zeek TSV file type
	HandlesECSRecord(data input.ECSRecord) bool
}

TSVFileType provides methods for formatting ECSRecords as Zeek TSV entries

type TSVHeader

type TSVHeader struct {
	Separator    string
	SetSeparator string
	EmptyField   string
	UnsetField   string
	Path         string
	OpenTime     time.Time
	Fields       []string
	Types        []string
}

TSVHeader represents the header fields of a Zeek TSV document

func (TSVHeader) String

func (z TSVHeader) String() string

String formats the ZeekHeader as the header of a Zeek TSV document

func (TSVHeader) WithOpenTime

func (z TSVHeader) WithOpenTime(openTime time.Time) TSVHeader

WithOpenTime returns a copy of the ZeekHeader with the given open_time

Jump to

Keyboard shortcuts

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