Documentation
¶
Index ¶
- Constants
- func GetSession(r *http.Request) *session.Session
- type ContextResponse
- type DashboardStatsResponse
- type HTTPStatsData
- type Handler
- func (h *Handler) Context(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ExportLogs(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetDashboardStats(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetLogsData(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetProjects(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleLogin(w http.ResponseWriter, r *http.Request)
- func (h *Handler) HandleLogout(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ShowAlerts(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ShowConnections(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ShowDashboard(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ShowLogin(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ShowLogs(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ShowProjects(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ShowUsers(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StreamLogs(w http.ResponseWriter, r *http.Request)
- type HandlerConfig
- type LogItem
- type LogsDataResponse
- type ProjectListItem
- type SourceData
- type VolumeData
Constants ¶
const SessionContextKey contextKey = "session"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContextResponse ¶
type ContextResponse struct {
Target *LogItem `json:"target"`
Before []*LogItem `json:"before"`
After []*LogItem `json:"after"`
HasMoreBefore bool `json:"has_more_before"`
HasMoreAfter bool `json:"has_more_after"`
BeforeCursor string `json:"before_cursor,omitempty"`
AfterCursor string `json:"after_cursor,omitempty"`
}
ContextResponse wraps logs surrounding the anchor log.
type DashboardStatsResponse ¶
type DashboardStatsResponse struct {
TimeRange string `json:"time_range"`
TotalLogs int64 `json:"total_logs"`
ErrorCount int64 `json:"error_count"`
WarningCount int64 `json:"warning_count"`
FatalCount int64 `json:"fatal_count"`
ErrorRate float64 `json:"error_rate"`
ActiveAlerts int `json:"active_alerts"`
Volume []VolumeData `json:"volume,omitempty"`
TopSources []SourceData `json:"top_sources,omitempty"`
HTTPStats *HTTPStatsData `json:"http_stats,omitempty"`
}
DashboardStatsResponse contains JSON response for dashboard stats
type HTTPStatsData ¶
type HTTPStatsData struct {
Total2xx int64 `json:"total_2xx"`
Total3xx int64 `json:"total_3xx"`
Total4xx int64 `json:"total_4xx"`
Total5xx int64 `json:"total_5xx"`
}
HTTPStatsData contains HTTP status code distribution
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandlerWithConfig ¶
func NewHandlerWithConfig(cfg HandlerConfig) *Handler
NewHandlerWithConfig creates a handler with full configuration.
func (*Handler) ExportLogs ¶
func (h *Handler) ExportLogs(w http.ResponseWriter, r *http.Request)
func (*Handler) GetDashboardStats ¶
func (h *Handler) GetDashboardStats(w http.ResponseWriter, r *http.Request)
GetDashboardStats returns dashboard statistics as JSON
func (*Handler) GetLogsData ¶
func (h *Handler) GetLogsData(w http.ResponseWriter, r *http.Request)
func (*Handler) GetProjects ¶
func (h *Handler) GetProjects(w http.ResponseWriter, r *http.Request)
GetProjects returns accessible projects for the current user.
func (*Handler) HandleLogin ¶
func (h *Handler) HandleLogin(w http.ResponseWriter, r *http.Request)
func (*Handler) HandleLogout ¶
func (h *Handler) HandleLogout(w http.ResponseWriter, r *http.Request)
func (*Handler) ShowAlerts ¶
func (h *Handler) ShowAlerts(w http.ResponseWriter, r *http.Request)
ShowAlerts renders the alerts management page Accessible to all authenticated users (view), create/edit for operator+, delete for admin
func (*Handler) ShowConnections ¶
func (h *Handler) ShowConnections(w http.ResponseWriter, r *http.Request)
ShowConnections renders the connections management page (admin only)
func (*Handler) ShowDashboard ¶
func (h *Handler) ShowDashboard(w http.ResponseWriter, r *http.Request)
func (*Handler) ShowProjects ¶
func (h *Handler) ShowProjects(w http.ResponseWriter, r *http.Request)
ShowProjects renders the projects management page (admin only)
func (*Handler) ShowUsers ¶
func (h *Handler) ShowUsers(w http.ResponseWriter, r *http.Request)
ShowUsers renders the users management page (admin only)
func (*Handler) StreamLogs ¶
func (h *Handler) StreamLogs(w http.ResponseWriter, r *http.Request)
type HandlerConfig ¶
type HandlerConfig struct {
Storage storage.Storage
LogStorage storage.LogStorage
Sessions *session.Store
CSRFKey string
LockoutThreshold int
LockoutDuration time.Duration
}
HandlerConfig contains configuration for the web handler.
type LogItem ¶
type LogItem struct {
ID string `json:"id"`
ProjectID string `json:"project_id,omitempty"`
Timestamp string `json:"timestamp"`
Level string `json:"level"`
Message string `json:"message"`
Source string `json:"source,omitempty"`
Type string `json:"type,omitempty"`
AgentID string `json:"agent_id,omitempty"`
FilePath string `json:"file_path,omitempty"`
LineNumber int64 `json:"line_number,omitempty"`
Fields map[string]interface{} `json:"fields,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
HTTPStatus int `json:"http_status,omitempty"`
HTTPMethod string `json:"http_method,omitempty"`
URI string `json:"uri,omitempty"`
}
LogItem represents a log entry in web responses
type LogsDataResponse ¶
type LogsDataResponse struct {
Items []*LogItem `json:"items"`
Total int64 `json:"total"`
Page int `json:"page"`
PerPage int `json:"per_page"`
TotalPages int `json:"total_pages"`
}
LogsDataResponse wraps paginated log list for JSON response
type ProjectListItem ¶
ProjectListItem represents a project for dropdown selection.
type SourceData ¶
type SourceData struct {
Source string `json:"source"`
Count int64 `json:"count"`
ErrorCount int64 `json:"error_count"`
}
SourceData represents log count per source
type VolumeData ¶
type VolumeData struct {
Timestamp string `json:"timestamp"`
TotalCount int64 `json:"total_count"`
ErrorCount int64 `json:"error_count"`
}
VolumeData represents a time-series data point for charts