auditlog

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package auditlog contains logging structs.

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogSync ensure that logs are written sync.
	// Useful for testing.
	LogSync bool
)

Functions

func WriteAccessLog

func WriteAccessLog(ctx context.Context, client *logging.Client, log *AccessLog)

WriteAccessLog puts the access log to StackDriver.

func WritePolicyDecisionLog added in v0.8.5

func WritePolicyDecisionLog(client *logging.Client, log *PolicyDecisionLog)

WritePolicyDecisionLog puts the policy decision log to StackDriver.

Types

type AccessLog

type AccessLog struct {
	// TokenID is the id of the token, maybe "jti".
	TokenID string
	// TokenSubject is the "sub" of the token.
	TokenSubject string
	// TokenIssuer is the iss of the token.
	TokenIssuer string
	// TracingID is the id of request from proxies.
	TracingID string
	// RequestMethod is the http method of the request.
	RequestMethod string
	// RequestEndpoint is the absolute path of the request.
	RequestEndpoint string
	// RequestIP is the requester IP.
	RequestIP string
	// ErrorType formats like "no_token" for search.
	ErrorType string
	// ResponseCode is the response code.
	ResponseCode int
	// Request stores the http.Request.
	Request *http.Request
	// PassAuthCheck if the request pass the auth checker.
	PassAuthCheck bool
	// Payload of the log.
	Payload interface{}
}

AccessLog logs the http endpoint accessing.

type PolicyDecisionLog added in v0.8.5

type PolicyDecisionLog struct {
	// TokenID is the id of the token, maybe "jti".
	TokenID string
	// TokenSubject is the "sub" of the token.
	TokenSubject string
	// TokenIssuer is the iss of the token.
	TokenIssuer string
	// Resource identifies the dataset.
	Resource string
	// TTL that user requested to grant.
	TTL string
	// PassAuthCheck if the request pass the auth checker.
	PassAuthCheck bool
	// ErrorType of deny.
	ErrorType string
	// CartID of request.
	CartID string
	// ConfigRevision the request using. Can use /config/history/{revision} to see the policy.
	ConfigRevision int64
	// Message of deny.
	Message interface{}
}

PolicyDecisionLog logs the dataset access request be granted or denied and the reason.

Jump to

Keyboard shortcuts

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