- Updated LiveLogViewer to support a new security mode, allowing for the display of security logs. - Implemented mock functions for connecting to security logs in tests. - Added tests for rendering, filtering, and displaying security log entries, including blocked requests and source filtering. - Modified Security page to utilize the new security mode in LiveLogViewer. - Updated Security page tests to reflect changes in log viewer and ensure proper rendering of security-related components. - Introduced a new script for CrowdSec startup testing, ensuring proper configuration and parser installation. - Added pre-flight checks in the CrowdSec integration script to verify successful startup and configuration.
24 lines
1.3 KiB
Go
24 lines
1.3 KiB
Go
// Package models defines the data types used throughout the application.
|
|
package models
|
|
|
|
// SecurityLogEntry represents a security-relevant log entry for live streaming.
|
|
// This struct is used by the LogWatcher service to broadcast parsed Caddy access logs
|
|
// with security event annotations to WebSocket clients.
|
|
type SecurityLogEntry struct {
|
|
Timestamp string `json:"timestamp"`
|
|
Level string `json:"level"`
|
|
Logger string `json:"logger"`
|
|
ClientIP string `json:"client_ip"`
|
|
Method string `json:"method"`
|
|
URI string `json:"uri"`
|
|
Status int `json:"status"`
|
|
Duration float64 `json:"duration"`
|
|
Size int64 `json:"size"`
|
|
UserAgent string `json:"user_agent"`
|
|
Host string `json:"host"`
|
|
Source string `json:"source"` // "waf", "crowdsec", "ratelimit", "acl", "normal"
|
|
Blocked bool `json:"blocked"` // True if request was blocked
|
|
BlockReason string `json:"block_reason,omitempty"` // Reason for blocking
|
|
Details map[string]interface{} `json:"details,omitempty"` // Additional metadata
|
|
}
|