Documentation
¶
Index ¶
- type ActorStats
- type ActorType
- type AuditEvent
- type AuditFilter
- type AuditStats
- type Config
- type DB
- func (db *DB) CleanupOldEvents(olderThan time.Duration) (int64, error)
- func (db *DB) Close() error
- func (db *DB) GetEventByEventID(eventID string) (*AuditEvent, error)
- func (db *DB) GetEventByID(id int64) (*AuditEvent, error)
- func (db *DB) GetEvents(filter *AuditFilter) ([]AuditEvent, int, error)
- func (db *DB) GetStats() (*AuditStats, error)
- func (db *DB) InsertEvent(event *AuditEvent) (int64, error)
- type Manager
- func (m *Manager) Cleanup() (int64, error)
- func (m *Manager) Close() error
- func (m *Manager) ExportEvents(filter *AuditFilter, format string) ([]byte, error)
- func (m *Manager) GetEventByEventID(eventID string) (*AuditEvent, error)
- func (m *Manager) GetEventByID(id int64) (*AuditEvent, error)
- func (m *Manager) GetEvents(filter *AuditFilter) ([]AuditEvent, int, error)
- func (m *Manager) GetStats() (*AuditStats, error)
- func (m *Manager) IsEnabled() bool
- func (m *Manager) LogEvent(event *AuditEvent) error
- func (m *Manager) ShouldCaptureBody() bool
- func (m *Manager) ShouldCapturePath(path string) bool
- type Middleware
- type TrendPoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActorStats ¶
type AuditEvent ¶
type AuditEvent struct {
ID int64 `json:"id"`
EventID string `json:"event_id"`
Timestamp time.Time `json:"timestamp"`
ActorType ActorType `json:"actor_type"`
ActorID string `json:"actor_id,omitempty"`
ActorName string `json:"actor_name,omitempty"`
APIKeyPrefix string `json:"api_key_prefix,omitempty"`
Action string `json:"action"`
Method string `json:"method"`
Path string `json:"path"`
ResourceType string `json:"resource_type,omitempty"`
ResourceID string `json:"resource_id,omitempty"`
ClientIP string `json:"client_ip"`
UserAgent string `json:"user_agent,omitempty"`
RequestID string `json:"request_id,omitempty"`
RequestBody string `json:"request_body,omitempty"`
ResponseStatus int `json:"response_status"`
ResponseTimeMs int64 `json:"response_time_ms"`
Success bool `json:"success"`
ErrorMessage string `json:"error_message,omitempty"`
Metadata string `json:"metadata,omitempty"`
}
type AuditFilter ¶
type AuditStats ¶
type AuditStats struct {
TotalEvents int `json:"total_events"`
Last24Hours int `json:"last_24_hours"`
Last7Days int `json:"last_7_days"`
ByAction map[string]int `json:"by_action"`
ByActorType map[string]int `json:"by_actor_type"`
ByResourceType map[string]int `json:"by_resource_type"`
FailureCount int `json:"failure_count"`
TopActors []ActorStats `json:"top_actors"`
EventsTrend []TrendPoint `json:"events_trend"`
}
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) CleanupOldEvents ¶
func (*DB) GetEventByEventID ¶
func (db *DB) GetEventByEventID(eventID string) (*AuditEvent, error)
func (*DB) GetEventByID ¶
func (db *DB) GetEventByID(id int64) (*AuditEvent, error)
func (*DB) GetEvents ¶
func (db *DB) GetEvents(filter *AuditFilter) ([]AuditEvent, int, error)
func (*DB) GetStats ¶
func (db *DB) GetStats() (*AuditStats, error)
func (*DB) InsertEvent ¶
func (db *DB) InsertEvent(event *AuditEvent) (int64, error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) ExportEvents ¶
func (m *Manager) ExportEvents(filter *AuditFilter, format string) ([]byte, error)
func (*Manager) GetEventByEventID ¶
func (m *Manager) GetEventByEventID(eventID string) (*AuditEvent, error)
func (*Manager) GetEventByID ¶
func (m *Manager) GetEventByID(id int64) (*AuditEvent, error)
func (*Manager) GetEvents ¶
func (m *Manager) GetEvents(filter *AuditFilter) ([]AuditEvent, int, error)
func (*Manager) GetStats ¶
func (m *Manager) GetStats() (*AuditStats, error)
func (*Manager) LogEvent ¶
func (m *Manager) LogEvent(event *AuditEvent) error
func (*Manager) ShouldCaptureBody ¶
func (*Manager) ShouldCapturePath ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(manager *Manager) *Middleware
func (*Middleware) Capture ¶
func (m *Middleware) Capture() gin.HandlerFunc
type TrendPoint ¶
Click to show internal directories.
Click to hide internal directories.