logger

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logger creates an osquery logging plugin.

See https://osquery.readthedocs.io/en/latest/development/logger-plugins/ for more.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFunc

type LogFunc func(ctx context.Context, typ LogType, log string) error

LogFunc is the logger function used by an osquery Logger plugin.

The LogFunc should log the provided result string. The LogType argument can be optionally used to log differently depending on the type of log received. The context argument can optionally be used for cancellation in long-running operations.

type LogType

type LogType int

LogType encodes the type of log osquery is outputting.

const (
	// LogTypeString to log a string
	LogTypeString LogType = iota
	// LogTypeSnapshot to log snapshot results
	LogTypeSnapshot
	// LogTypeHealth for health details logging
	LogTypeHealth
	// LogTypeInit for init details logging
	LogTypeInit
	// LogTypeStatus for differential results status logging
	LogTypeStatus
)

func (LogType) String

func (l LogType) String() string

String implements the fmt.Stringer interface for LogType.

type Plugin

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

Plugin is an osquery logger plugin. The Plugin struct implements the OsqueryPlugin interface.

func NewPlugin

func NewPlugin(name string, fn LogFunc) *Plugin

NewPlugin takes a value that implements LoggerPlugin and wraps it with the appropriate methods to satisfy the OsqueryPlugin interface. Use this to easily create plugins implementing osquery loggers.

func (*Plugin) Call

Call is invoked to log the specified request details. Depending on the type of logger implementation, contents of the requests can be saved to a file, sent to remote destination etc after necessary formatting.

func (*Plugin) Name

func (t *Plugin) Name() string

Name returns the logger plugin name.

func (*Plugin) Ping

func (t *Plugin) Ping() osquery.ExtensionStatus

Ping returns static "OK" response.

func (*Plugin) RegistryName

func (t *Plugin) RegistryName() string

RegistryName always returns static string "logger" for logger plugins.

func (*Plugin) Routes

Routes returns empty plugin response for logger plugins.

func (*Plugin) Shutdown

func (t *Plugin) Shutdown()

Shutdown is a no-op function for logger plugins.

Jump to

Keyboard shortcuts

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