auditlog
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package auditlog provides a mechanism for logging audit events.
Index¶
Constants¶
This section is empty.
Variables¶
var ErrAuditLogStorageFailure =errors.New("audit log storage failure")ErrAuditLogStorageFailure is returned when the logger fails to persist logs to the store.
Functions¶
funcDefaultStoreFilePath¶added inv1.84.0
DefaultStoreFilePath returns the default audit log store file pathfor the current platform, or an error if the platform does not have one.
funcIsRetryableError¶
IsRetryableError returns true if the given error is retryableSee [controlclient.apiResponseError]. Potentially retryable errors implement the Retryable() method.
funcSetStoreFilePath¶added inv1.84.0
func SetStoreFilePath(pathstring)
SetStoreFilePath sets the audit log store file path.It is optional on platforms with a default store path,but required on platforms without one (e.g., macOS).It panics if called more than once or after the store has been created.
Types¶
typeLogStore¶
type LogStore interface {// contains filtered or unexported methods}LogStore provides a means for aLogger to persist logs to disk or memory.
funcNewLogStore¶
func NewLogStore(storeipn.StateStore)LogStore
NewLogStore creates a new LogStateStore with the givenipn.StateStore.
typeLogger¶
type Logger struct {// contains filtered or unexported fields}Logger provides a queue-based mechanism for submitting audit logs to the control plane - oranother suitable consumer. Logs are stored to disk and retried until they are successfully sent,or until they permanently fail.
Each individual profile/controlclient tuple should construct and manage a uniqueLogger instance.
func (*Logger)Enqueue¶
func (al *Logger) Enqueue(actiontailcfg.ClientAuditAction, detailsstring)error
Enqueue queues an audit log to be sent to the control plane (or another suitable consumer/transport).This will return an error if the underlying store fails to save the log or we fail to generate a uniqueeventID for the log.
func (*Logger)FlushAndStop¶
FlushAndStop synchronously flushes all pending logs and stops the audit logger.This will block until a final flush operation completes or context is done.If the logger is already stopped, this will return immediately. All unsentlogs will be persisted to the store.
func (*Logger)SetProfileID¶
SetProfileID sets the profileID for the logger. This must be called before any logs can be enqueued.The profileID of a logger cannot be changed once set.
typeOpts¶
type Opts struct {// RetryLimit is the maximum number of attempts the logger will make to send a log before giving up.RetryLimitint// Store is the persistent store used to save logs to disk. Must be non-nil.StoreLogStore// Logf is the logger used to log messages from the audit logger. Must be non-nil.Logflogger.Logf}Opts contains the configuration options for aLogger.
typeTransport¶
type Transport interface {// SendAuditLog sends an audit log to a consumer of audit logs.// Errors should be checked with [IsRetryableError] for retryability.SendAuditLog(context.Context,tailcfg.AuditLogRequest)error}Transport provides a means for a client to send audit logs to a consumer (typically the control plane).