auditlog

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Log types
	LogTypeLogin       = 1
	LogTypeLogout      = 2
	LogTypeNode        = 3
	LogTypeQuery       = 4
	LogTypeCarve       = 5
	LogTypeTag         = 6
	LogTypeEnvironment = 7
	LogTypeSetting     = 8
	LogTypeVisit       = 9
	LogTypeUser        = 10
	// Severities
	SeverityInfo    = 1
	SeverityWarning = 2
	SeverityError   = 3
	// No environment action
	NoEnvironment = 0
)
View Source
const (
	// Log type strings
	LogTypeLoginStr   = "Login"
	LogTypeLogoutStr  = "Logout"
	LogTypeNodeStr    = "Node"
	LogTypeQueryStr   = "Query"
	LogTypeCarveStr   = "Carve"
	LogTypeTagStr     = "Tag"
	LogTypeEnvStr     = "Environment"
	LogTypeSettingStr = "Setting"
	LogTypeVisitStr   = "Visit"
	LogTypeUserStr    = "User"
	LogTypeUnknown    = "Unknown"
	// Severity strings
	SeverityInfoStr    = "Info"
	SeverityWarningStr = "Warning"
	SeverityErrorStr   = "Error"
	SeverityUnknownStr = "Unknown"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLog

type AuditLog struct {
	gorm.Model
	Service       string
	Username      string
	Line          string
	LogType       uint
	Severity      uint
	SourceIP      string
	EnvironmentID uint
}

AuditLog to store all audit logs

type AuditLogManager

type AuditLogManager struct {
	DB      *gorm.DB
	Service string
	Enabled bool
}

AuditLogManager for audit logs

func CreateAuditLogManager

func CreateAuditLogManager(backend *gorm.DB, service string, enabled bool) (*AuditLogManager, error)

CreateAuditLogManager to initialize the audit log struct and tables

func (*AuditLogManager) CarveAction

func (m *AuditLogManager) CarveAction(username, action, ip string, envID uint)

CarveAction - create new carve action audit log entry

func (*AuditLogManager) ConfAction

func (m *AuditLogManager) ConfAction(username, action, ip string, envID uint)

ConfAction - create new configuration action audit log entry

func (*AuditLogManager) Create

func (m *AuditLogManager) Create(logLine *AuditLog) error

Create new audit log entry

func (*AuditLogManager) CreateNew

func (m *AuditLogManager) CreateNew(username, line, ip string, logType, severity, envID uint) error

CreateNew - create new audit log entry

func (*AuditLogManager) EnvAction

func (m *AuditLogManager) EnvAction(username, action, ip string, envID uint)

EnvAction - create new environment action audit log entry

func (*AuditLogManager) GetAll

func (m *AuditLogManager) GetAll() ([]AuditLog, error)

GetAll - get all audit logs

func (*AuditLogManager) GetByEnv

func (m *AuditLogManager) GetByEnv(envID uint) ([]AuditLog, error)

GetByEnv - get audit logs by environment

func (*AuditLogManager) GetBySeverityEnv

func (m *AuditLogManager) GetBySeverityEnv(severity, envID uint) ([]AuditLog, error)

GetBySeverityEnv - get audit logs by severity and environment

func (*AuditLogManager) GetByTypeEnv

func (m *AuditLogManager) GetByTypeEnv(logType, envID uint) ([]AuditLog, error)

GetByType - get audit logs by type and environment

func (*AuditLogManager) LogTypeToString

func (m *AuditLogManager) LogTypeToString(logType uint) string

LogTypeToString to convert log type to string

func (*AuditLogManager) New

func (m *AuditLogManager) New(username, line, ip string, logType, severity, envID uint) (AuditLog, error)

New audit log entry

func (*AuditLogManager) NewCarve

func (m *AuditLogManager) NewCarve(username, path, ip string, envID uint)

NewCarve - create new carve audit log entry

func (*AuditLogManager) NewLogin

func (m *AuditLogManager) NewLogin(username, ip string)

NewLogin - create new login audit log entry

func (*AuditLogManager) NewLogout

func (m *AuditLogManager) NewLogout(username, ip string)

NewLogout - create new logout audit log entry

func (*AuditLogManager) NewQuery

func (m *AuditLogManager) NewQuery(username, query, ip string, envID uint)

NewQuery - create new query audit log entry

func (*AuditLogManager) NewToken

func (m *AuditLogManager) NewToken(username, ip string)

NewToken - create new token audit log entry

func (*AuditLogManager) NodeAction

func (m *AuditLogManager) NodeAction(username, action, ip string, envID uint)

NodeAction - create new node action audit log entry

func (*AuditLogManager) Permissions

func (m *AuditLogManager) Permissions(username, action, ip string, envID uint)

Permissions - create new permissions action audit log entry

func (*AuditLogManager) QueryAction

func (m *AuditLogManager) QueryAction(username, action, ip string, envID uint)

QueryAction - create new query action audit log entry

func (*AuditLogManager) SettingsAction

func (m *AuditLogManager) SettingsAction(username, action, ip string)

SettingsAction - create new settings action audit log entry

func (*AuditLogManager) SeverityToString

func (m *AuditLogManager) SeverityToString(severity uint) string

SeverityToString to convert severity to string

func (*AuditLogManager) TagAction

func (m *AuditLogManager) TagAction(username, action, ip string, envID uint)

TagAction - create new tag action audit log entry

func (*AuditLogManager) UserAction

func (m *AuditLogManager) UserAction(username, action, ip string)

UserAction - create new user action audit log entry

func (*AuditLogManager) Visit

func (m *AuditLogManager) Visit(username, path, ip string, envID uint)

Visit - create new visit tag audit log entry

Jump to

Keyboard shortcuts

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