Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultPageSize is the default number of records per page DefaultPageSize = 50 // MaxPageSize is the maximum number of records allowed per page MaxPageSize = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessLogEntry ¶
type AccessLogEntry struct {
ID string `gorm:"primaryKey"`
AccountID string `gorm:"index"`
ServiceID string `gorm:"index"`
Timestamp time.Time `gorm:"index"`
GeoLocation peer.Location `gorm:"embedded;embeddedPrefix:location_"`
Method string `gorm:"index"`
Host string `gorm:"index"`
Path string `gorm:"index"`
Duration time.Duration `gorm:"index"`
StatusCode int `gorm:"index"`
Reason string
UserId string `gorm:"index"`
AuthMethodUsed string `gorm:"index"`
}
func (*AccessLogEntry) FromProto ¶
func (a *AccessLogEntry) FromProto(serviceLog *proto.AccessLog)
FromProto creates an AccessLogEntry from a proto.AccessLog
func (*AccessLogEntry) ToAPIResponse ¶
func (a *AccessLogEntry) ToAPIResponse() *api.ProxyAccessLog
ToAPIResponse converts an AccessLogEntry to the API ProxyAccessLog type
type AccessLogFilter ¶
type AccessLogFilter struct {
// Page is the current page number (1-indexed)
Page int
// PageSize is the number of records per page
PageSize int
// Filtering parameters
Search *string // General search across log ID, host, path, source IP, and user fields
SourceIP *string // Filter by source IP address
Host *string // Filter by host header
Path *string // Filter by request path (supports LIKE pattern)
UserID *string // Filter by authenticated user ID
UserEmail *string // Filter by user email (requires user lookup)
UserName *string // Filter by user name (requires user lookup)
Method *string // Filter by HTTP method
Status *string // Filter by status: "success" (2xx/3xx) or "failed" (1xx/4xx/5xx)
StatusCode *int // Filter by HTTP status code
StartDate *time.Time // Filter by timestamp >= start_date
EndDate *time.Time // Filter by timestamp <= end_date
}
AccessLogFilter holds pagination and filtering parameters for access logs
func (*AccessLogFilter) GetLimit ¶
func (f *AccessLogFilter) GetLimit() int
GetLimit returns the page size for database queries
func (*AccessLogFilter) GetOffset ¶
func (f *AccessLogFilter) GetOffset() int
GetOffset calculates the database offset for pagination
func (*AccessLogFilter) ParseFromRequest ¶
func (f *AccessLogFilter) ParseFromRequest(r *http.Request)
ParseFromRequest parses pagination and filter parameters from HTTP request query parameters
type Manager ¶
type Manager interface {
SaveAccessLog(ctx context.Context, proxyLog *AccessLogEntry) error
GetAllAccessLogs(ctx context.Context, accountID, userID string, filter *AccessLogFilter) ([]*AccessLogEntry, int64, error)
}
Click to show internal directories.
Click to hide internal directories.