audit

package
v3.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2018 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package audit log the beginning and end of each API request to different logger. The records also contains information about the request status and error message if it fails.

Index

Constants

View Source
const (
	LogEntryType     = "openshift.logger"
	AuditUserEntry   = "openshift.auth.user"
	AuditUserIDEntry = "openshift.auth.userid"
	AuditStatusEntry = "openshift.request.status"
	AuditErrorEntry  = "openshift.request.error"

	DefaultLoggerType = "registry"
	AuditLoggerType   = "audit"

	OpStatusBegin = "begin"
	OpStatusError = "error"
	OpStatusOK    = "success"
)

Variables

This section is empty.

Functions

func LoggerExists

func LoggerExists(ctx context.Context) (exists bool)

LoggerExists checks audit logger existence.

func NewBlobStore

NewBlobStore wraps a distribution.BlobStore to track operation results and write them to the audit log.

func NewManifestService

NewManifestService wraps a distribution.ManifestService to track operation results and write them to the audit log.

func NewTagService

NewTagService wraps a distribution.TagService to track operation results and write them to the audit log,

func WithLogger

func WithLogger(ctx context.Context, logger *Logger) context.Context

WithLogger creates a new context with provided logger.

Types

type Logger

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

Logger implements special audit log. We can't use the system logger because the change of log level can hide the audit logs.

func GetLogger

func GetLogger(ctx context.Context) *Logger

GetLogger returns the logger from the current context, if present. It will be created otherwise.

func NewLogger

func NewLogger(ctx context.Context) *Logger

NewLogger returns new audit logger which inherits fields from the system logger.

func (*Logger) Log

func (l *Logger) Log(args ...interface{})

Log logs record.

func (*Logger) LogResult

func (l *Logger) LogResult(err error, args ...interface{})

LogResult logs record with additional operation status.

func (*Logger) LogResultf

func (l *Logger) LogResultf(err error, format string, args ...interface{})

LogResultf formats record according to a format with additional operation status.

func (*Logger) Logf

func (l *Logger) Logf(format string, args ...interface{})

Logf formats record according to a format.

func (*Logger) SetFormatter

func (l *Logger) SetFormatter(formatter logrus.Formatter)

SetFormatter sets the audit logger formatter.

Jump to

Keyboard shortcuts

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