Movatterモバイル変換


[0]ホーム

URL:


auditlog

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:23Imported by:2

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package auditlog provides a mechanism for logging audit events.

Index

Constants

This section is empty.

Variables

View Source
var ErrAuditLogStorageFailure =errors.New("audit log storage failure")

ErrAuditLogStorageFailure is returned when the logger fails to persist logs to the store.

Functions

funcDefaultStoreFilePathadded inv1.84.0

func DefaultStoreFilePath() (string,error)

DefaultStoreFilePath returns the default audit log store file pathfor the current platform, or an error if the platform does not have one.

funcIsRetryableError

func IsRetryableError(errerror)bool

IsRetryableError returns true if the given error is retryableSee [controlclient.apiResponseError]. Potentially retryable errors implement the Retryable() method.

funcSetStoreFilePathadded 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.

funcNewLogger

func NewLogger(optsOpts) *Logger

NewLogger creates a newLogger with the given options.

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

func (al *Logger) FlushAndStop(ctxcontext.Context)

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

func (al *Logger) SetProfileID(profileIDipn.ProfileID)error

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.

func (*Logger)Start

func (al *Logger) Start(tTransport)error

Start starts the audit logger with the given transport.It returns an error if the logger is already started.

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).

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp