auditLog

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MQ_EXCHANGE_AUDIT_LOG = "audit.log.send.direct"

Functions

func AuditServerUnaryInterceptor

func AuditServerUnaryInterceptor() grpc.UnaryServerInterceptor

func DurationToDurationField

func DurationToDurationField(duration time.Duration) (key string, value interface{})

DurationToDurationField uses the duration value to log the request duration.

func DurationToTimeMillisField

func DurationToTimeMillisField(duration time.Duration) (key string, value interface{})

DurationToTimeMillisField converts the duration to milliseconds and uses the key `grpc.time_ms`.

func FuncErrorToCode

func FuncErrorToCode(err error) codes.Code

func Init

func Init(amqpConfig AMQPConfig, _fkConfig FKConfig, env string) error

func JSONFormatter

func JSONFormatter(payload string) string

Types

type AMQPConfig

type AMQPConfig struct {
	Server   string
	Username string
	Password string
	Exchange string
	Port     string
}

type Audit

type Audit struct {
	LogType        string  `json:"logType"`
	Message        message `json:"message"`
	DomainId       int     `json:"domainId"`
	SrcDomainId    int     `json:"srcDomainId"`
	ServiceName    string  `json:"serviceName"`
	SrcServiceName string  `json:"srcServiceName"`
	ProjectId      int     `json:"projectId"`
	SrcProjectId   int     `json:"srcProjectId"`
	UserId         int     `json:"userId"`
	UserType       int     `json:"userType"`
	ObjectTypeId   int     `json:"objectTypeId"`
	Action         string  `json:"action"`
	OsEnv          string  `json:"osEnv"`
}

type DurationToField

type DurationToField func(duration time.Duration) (key string, value interface{})
var DefaultDurationToField DurationToField = DurationToTimeMillisField

DefaultDurationToField is the default implementation of converting request duration to a log field (key and value).

type ErrorToCode

type ErrorToCode func(err error) codes.Code
var DefaultErrorToCode ErrorToCode = FuncErrorToCode

type FKConfig

type FKConfig struct {
	DomainId    int
	ProjectId   int
	ServiceName string
}

Jump to

Keyboard shortcuts

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