s3log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLogger

type AuditLogger interface {
	Log(ctx *fiber.Ctx, err error, body []byte, meta LogMeta)
	HangUp() error
	Shutdown() error
}

func InitFileLogger

func InitFileLogger(logname string) (AuditLogger, error)

InitFileLogger initializes audit logs to local file

func InitLogger

func InitLogger(cfg *LogConfig) (AuditLogger, error)

func InitWebhookLogger

func InitWebhookLogger(url string) (AuditLogger, error)

InitWebhookLogger initializes audit logs to webhook URL

type FileLogger

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

FileLogger is a local file audit log

func (*FileLogger) HangUp

func (f *FileLogger) HangUp() error

HangUp closes current logfile handle and opens a new one typically needed for log rotations

func (*FileLogger) Log

func (f *FileLogger) Log(ctx *fiber.Ctx, err error, body []byte, meta LogMeta)

Log sends log message to file logger

func (*FileLogger) Shutdown

func (f *FileLogger) Shutdown() error

Shutdown closes logfile handle

type LogConfig

type LogConfig struct {
	LogFile    string
	WebhookURL string
}

type LogFields

type LogFields struct {
	BucketOwner        string
	Bucket             string
	Time               time.Time
	RemoteIP           string
	Requester          string
	RequestID          string
	Operation          string
	Key                string
	RequestURI         string
	HttpStatus         int
	ErrorCode          string
	BytesSent          int
	ObjectSize         int64
	TotalTime          int64
	TurnAroundTime     int64
	Referer            string
	UserAgent          string
	VersionID          string
	HostID             string
	SignatureVersion   string
	CipherSuite        string
	AuthenticationType string
	HostHeader         string
	TLSVersion         string
	AccessPointARN     string
	AclRequired        string
}

type LogMeta

type LogMeta struct {
	BucketOwner string
	ObjectSize  int64
	Action      string
}

type WebhookLogger

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

WebhookLogger is a webhook URL audit log

func (*WebhookLogger) HangUp

func (wl *WebhookLogger) HangUp() error

HangUp does nothing for webhooks

func (*WebhookLogger) Log

func (wl *WebhookLogger) Log(ctx *fiber.Ctx, err error, body []byte, meta LogMeta)

Log sends log message to webhook

func (*WebhookLogger) Shutdown

func (wl *WebhookLogger) Shutdown() error

Shutdown does nothing for webhooks

Jump to

Keyboard shortcuts

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