auditlog

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 18 Imported by: 12

Documentation

Index

Constants

View Source
const (
	Audit_Module           = "audit"
	FileNameDateFormat     = "20060102150405"
	ShiftedExtension       = ".old"
	DefaultAuditLogBufSize = 0

	F_OK                 = 0
	DefaultCleanInterval = 1 * time.Hour
	DefaultAuditLogSize  = 200 * 1024 * 1024 // 200M
	DefaultHeadRoom      = 50 * 1024         // 50G
	MaxReservedDays      = 7 * 24 * time.Hour
)
View Source
const (
	EnableAuditLogReqPath     = "/auditlog/enable"
	DisableAuditLogReqPath    = "/auditlog/disable"
	SetAuditLogBufSizeReqPath = "/auditlog/setbufsize"
)

Variables

View Source
var DefaultTimeOutUs = [3]uint32{100000, 500000, 1000000}

Functions

func AddLog

func AddLog(content string)

func BuildFailureResp

func BuildFailureResp(w http.ResponseWriter, code int, msg string)

func BuildSuccessResp

func BuildSuccessResp(w http.ResponseWriter, data interface{})

func DisableAuditLog

func DisableAuditLog(w http.ResponseWriter, r *http.Request)

func GetAuditLogInfo

func GetAuditLogInfo() (dir, logModule string, logMaxSize int64, err error)

func LogClientOp

func LogClientOp(op, src, dst string, err error, latency int64, srcInode, dstInode uint64)

func LogDataNodeOp

func LogDataNodeOp(op, msg string, err error)

func LogDentryOp

func LogDentryOp(clientAddr, volume, op, name, fullPath string, err error, latency int64, ino, parentIno uint64)

func LogInodeOp

func LogInodeOp(clientAddr, volume, op, fullPath string, err error, latency int64, ino uint64, fileSize uint64)

func LogMasterOp

func LogMasterOp(op, msg string, err error)

func LogTxOp

func LogTxOp(clientAddr, volume, op, txId string, err error, latency int64)

func ResetWriterBuffSize

func ResetWriterBuffSize(w http.ResponseWriter, r *http.Request)

NOTE: for client http apis

func ResetWriterBufferSize

func ResetWriterBufferSize(size int)

func StopAudit

func StopAudit()

Types

type Audit

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

func InitAudit

func InitAudit(dir, logModule string, logMaxSize int64) (*Audit, error)

func InitAuditWithPrefix

func InitAuditWithPrefix(dir, logModule string, logMaxSize int64, prefix *AuditPrefix) (a *Audit, err error)

func NewAudit

func NewAudit(dir, logModule string, logMaxSize int64) (*Audit, error)

func NewAuditWithPrefix

func NewAuditWithPrefix(dir, logModule string, logMaxSize int64, prefix *AuditPrefix) (a *Audit, err error)

func (*Audit) AddLog

func (a *Audit) AddLog(content string)

func (*Audit) GetInfo

func (a *Audit) GetInfo() (dir, logModule string, logMaxSize int64)

func (*Audit) LogChangeDpDecommission

func (a *Audit) LogChangeDpDecommission(oldStatus string, status string, src string, disk string, dpId uint64, dst string)

func (*Audit) LogClientOp

func (a *Audit) LogClientOp(op, src, dst string, err error, latency int64, srcInode, dstInode uint64)

func (*Audit) LogDentryOp

func (a *Audit) LogDentryOp(clientAddr, volume, op, name, fullPath string, err error, latency int64, ino, parentIno uint64)

func (*Audit) LogInodeOp

func (a *Audit) LogInodeOp(clientAddr, volume, op, fullPath string, err error, latency int64, ino uint64, fileSize uint64)

func (*Audit) LogResetDpDecommission

func (a *Audit) LogResetDpDecommission(status string, src string, disk string, dpId uint64, dst string)

func (*Audit) LogTxOp

func (a *Audit) LogTxOp(clientAddr, volume, op, txId string, err error, latency int64)

func (*Audit) ResetWriterBufferSize

func (a *Audit) ResetWriterBufferSize(size int)

func (*Audit) Stop

func (a *Audit) Stop()

NOTE: Please call me in single-thread

type AuditPrefix

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

func NewAuditPrefix

func NewAuditPrefix(p ...string) *AuditPrefix

func (*AuditPrefix) String

func (a *AuditPrefix) String() string

type ShiftedFile

type ShiftedFile []os.FileInfo

func (ShiftedFile) Len

func (f ShiftedFile) Len() int

func (ShiftedFile) Less

func (f ShiftedFile) Less(i, j int) bool

func (ShiftedFile) Swap

func (f ShiftedFile) Swap(i, j int)

Jump to

Keyboard shortcuts

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