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
- func LoggerExists(ctx context.Context) (exists bool)
- func NewBlobStore(ctx context.Context, store distribution.BlobStore) distribution.BlobStore
- func NewManifestService(ctx context.Context, manifests distribution.ManifestService) distribution.ManifestService
- func NewTagService(ctx context.Context, tags distribution.TagService) distribution.TagService
- func WithLogger(ctx context.Context, logger *AuditLogger) context.Context
- type AuditLogger
- func (l *AuditLogger) Log(args ...interface{})
- func (l *AuditLogger) LogResult(err error, args ...interface{})
- func (l *AuditLogger) LogResultf(err error, format string, args ...interface{})
- func (l *AuditLogger) Logf(format string, args ...interface{})
- func (l *AuditLogger) SetFormatter(formatter logrus.Formatter)
- type BlobStore
- func (b *BlobStore) Create(ctx context.Context, options ...distribution.BlobCreateOption) (distribution.BlobWriter, error)
- func (b *BlobStore) Delete(ctx context.Context, dgst digest.Digest) error
- func (b *BlobStore) Get(ctx context.Context, dgst digest.Digest) ([]byte, error)
- func (b *BlobStore) Open(ctx context.Context, dgst digest.Digest) (distribution.ReadSeekCloser, error)
- func (b *BlobStore) Put(ctx context.Context, mediaType string, p []byte) (distribution.Descriptor, error)
- func (b *BlobStore) Resume(ctx context.Context, id string) (distribution.BlobWriter, error)
- func (b *BlobStore) ServeBlob(ctx context.Context, w http.ResponseWriter, req *http.Request, ...) error
- func (b *BlobStore) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error)
- type ManifestService
- func (m *ManifestService) Delete(ctx context.Context, dgst digest.Digest) error
- func (m *ManifestService) Exists(ctx context.Context, dgst digest.Digest) (bool, error)
- func (m *ManifestService) Get(ctx context.Context, dgst digest.Digest, ...) (distribution.Manifest, error)
- func (m *ManifestService) Put(ctx context.Context, manifest distribution.Manifest, ...) (digest.Digest, error)
- type TagService
- func (t *TagService) All(ctx context.Context) ([]string, error)
- func (t *TagService) Get(ctx context.Context, tag string) (distribution.Descriptor, error)
- func (t *TagService) Lookup(ctx context.Context, digest distribution.Descriptor) ([]string, error)
- func (t *TagService) Tag(ctx context.Context, tag string, desc distribution.Descriptor) error
- func (t *TagService) Untag(ctx context.Context, tag string) error
Constants ¶
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 ¶
LoggerExists checks audit logger existence.
func NewBlobStore ¶
func NewBlobStore(ctx context.Context, store distribution.BlobStore) distribution.BlobStore
func NewManifestService ¶
func NewManifestService(ctx context.Context, manifests distribution.ManifestService) distribution.ManifestService
func NewTagService ¶
func NewTagService(ctx context.Context, tags distribution.TagService) distribution.TagService
func WithLogger ¶
func WithLogger(ctx context.Context, logger *AuditLogger) context.Context
WithLogger creates a new context with provided logger.
Types ¶
type AuditLogger ¶
type AuditLogger struct {
// contains filtered or unexported fields
}
AuditLogger 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) *AuditLogger
GetLogger returns the logger from the current context, if present. It will be created otherwise.
func MakeAuditLogger ¶
func MakeAuditLogger(ctx context.Context) *AuditLogger
MakeAuditLogger returns new audit logger which inherits fields from the system logger.
func (*AuditLogger) LogResult ¶
func (l *AuditLogger) LogResult(err error, args ...interface{})
LogResult logs record with additional operation status.
func (*AuditLogger) LogResultf ¶
func (l *AuditLogger) LogResultf(err error, format string, args ...interface{})
LogResultf formats record according to a format with additional operation status.
func (*AuditLogger) Logf ¶
func (l *AuditLogger) Logf(format string, args ...interface{})
Logf formats record according to a format.
func (*AuditLogger) SetFormatter ¶
func (l *AuditLogger) SetFormatter(formatter logrus.Formatter)
SetFormatter sets the audit logger formatter.
type BlobStore ¶
type BlobStore struct {
// contains filtered or unexported fields
}
BlobStore wraps a distribution.BlobStore to track operation result and write it in the audit log.
func (*BlobStore) Create ¶
func (b *BlobStore) Create(ctx context.Context, options ...distribution.BlobCreateOption) (distribution.BlobWriter, error)
func (*BlobStore) Open ¶
func (b *BlobStore) Open(ctx context.Context, dgst digest.Digest) (distribution.ReadSeekCloser, error)
func (*BlobStore) Put ¶
func (b *BlobStore) Put(ctx context.Context, mediaType string, p []byte) (distribution.Descriptor, error)
func (*BlobStore) Resume ¶
func (b *BlobStore) Resume(ctx context.Context, id string) (distribution.BlobWriter, error)
func (*BlobStore) Stat ¶
func (b *BlobStore) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error)
type ManifestService ¶
type ManifestService struct {
// contains filtered or unexported fields
}
ManifestService wraps a distribution.ManifestService to track operation result and write it in the audit log.
func (*ManifestService) Get ¶
func (m *ManifestService) Get(ctx context.Context, dgst digest.Digest, options ...distribution.ManifestServiceOption) (distribution.Manifest, error)
func (*ManifestService) Put ¶
func (m *ManifestService) Put(ctx context.Context, manifest distribution.Manifest, options ...distribution.ManifestServiceOption) (digest.Digest, error)
type TagService ¶
type TagService struct {
// contains filtered or unexported fields
}
TagService wraps a distribution.TagService to track operation result and write it in the audit log.
func (*TagService) Get ¶
func (t *TagService) Get(ctx context.Context, tag string) (distribution.Descriptor, error)
func (*TagService) Lookup ¶
func (t *TagService) Lookup(ctx context.Context, digest distribution.Descriptor) ([]string, error)
func (*TagService) Tag ¶
func (t *TagService) Tag(ctx context.Context, tag string, desc distribution.Descriptor) error