auditlog

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuditLogModule

func NewAuditLogModule(logger logging.Logger, deps *core.Dependencies) core.Module

NewAuditLogModule creates a new audit log module.

Types

type AuditLogHandler

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

func NewAuditLogHandler

func NewAuditLogHandler(service *AuditLogService, logger logging.Logger) *AuditLogHandler

func (*AuditLogHandler) Clear

Clear deletes old audit logs. @Summary Clear old audit logs @Tags Logs @Accept json @Produce json @Param request body ClearInput true "Retention settings" @Success 200 {object} responder.Response @Router /logs/audits/clear [post]

func (*AuditLogHandler) Delete

func (h *AuditLogHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete deletes a single audit log entry. @Summary Delete audit log @Tags Logs @Param id path string true "Log ID" @Success 200 {object} responder.Response @Router /logs/audits/{id} [delete]

func (*AuditLogHandler) List

List returns a list of audit logs. @Summary List audit logs @Tags Logs @Accept json @Produce json @Param page query int false "Page number" @Param pageSize query int false "Page size" @Param action query string false "Action" @Param resource query string false "Resource" @Param resource_id query string false "Resource ID" @Param user_id query string false "User ID" @Param ip query string false "IP address" @Param startDate query string false "Start date (RFC3339)" @Param endDate query string false "End date (RFC3339)" @Success 200 {object} responder.Response @Router /logs/audits [get]

type AuditLogModule

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

AuditLogModule manages the audit log module.

func (*AuditLogModule) Name

func (m *AuditLogModule) Name() string

func (*AuditLogModule) RegisterPrivateRoutes

func (m *AuditLogModule) RegisterPrivateRoutes(r chi.Router)

RegisterPrivateRoutes registers protected audit log endpoints.

func (*AuditLogModule) RegisterPublicRoutes

func (m *AuditLogModule) RegisterPublicRoutes(r chi.Router)

RegisterPublicRoutes registers public audit log endpoints (none).

type AuditLogService

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

func NewAuditLogService

func NewAuditLogService(client *ent.Client, logger logging.Logger) *AuditLogService

func (*AuditLogService) ClearOldLogs

func (s *AuditLogService) ClearOldLogs(ctx context.Context, retentionDays int) (int, error)

ClearOldLogs deletes audit logs older than retention days.

func (*AuditLogService) Delete

func (s *AuditLogService) Delete(ctx context.Context, id uuid.UUID) error

Delete deletes a specific audit log entry.

func (*AuditLogService) List

func (s *AuditLogService) List(ctx context.Context, input *LogQueryInput) ([]*ent.AuditLog, int, error)

List queries audit logs with filters.

type ClearInput

type ClearInput struct {
	RetentionDays int `json:"retentionDays"`
}

ClearInput defines parameters for clearing logs.

type LogQueryInput

type LogQueryInput struct {
	Page       int
	PageSize   int
	StartDate  *time.Time
	EndDate    *time.Time
	Action     string
	Resource   string
	ResourceID string
	UserID     *uuid.UUID
	IPAddress  string
}

LogQueryInput defines audit log query parameters.

Jump to

Keyboard shortcuts

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