F1 告警静默规则 [done]: - 后端 alert_silence.go: CRUD + Toggle (onetime/daily/weekly 三模式) - 告警引擎 isSilenced 集成 (alert_engine.go) - 前端 SilenceRuleTab + SilenceDialog - 路由 /alerts/silences 已注册 F2 审计日志导出 [done]: - 重写 ExportAuditLogs: 真正的 CSV 导出 (encoding/csv + UTF-8 BOM) - 支持 module/action/username/startTime/endTime 筛选 - 导出限制 10000 条防溢出,自动记录审计日志 - JSON 格式向后兼容 (format=json) - 前端 exportLogs 传递查询参数 同时包含累积的前期工作: - 目录重构 internal/ -> controller/model/router (v0.55-v0.57) - 后端分层架构 dto/repository/service/utils - 审计模块全功能 (终端审计/操作审计/登录日志) - asciicast v2 录制格式 - SFTP 文件浏览器 - StatStrip 紧凑统计条 - 在线会话自动刷新 - LiveMonitor WebSocket 诊断修复 验证: go build ✅ | npm run build ✅ | Docker 部署 ✅ | 10 回归端点 ✅ | CSV 导出 ✅ | 静默 CRUD ✅
37 lines
1.4 KiB
Go
37 lines
1.4 KiB
Go
package model
|
||
|
||
import "time"
|
||
|
||
// TerminalSession SSH终端会话记录(JumpServer 式终端审计) // Logan.Li
|
||
type TerminalSession struct {
|
||
ID uint `gorm:"primarykey" json:"id"`
|
||
UserID *uint `json:"user_id"`
|
||
Username string `gorm:"size:64" json:"username"`
|
||
ServerID uint `json:"server_id"`
|
||
ServerName string `gorm:"size:128" json:"server_name"`
|
||
ServerIP string `gorm:"size:64" json:"server_ip"`
|
||
ServerPort int `json:"server_port"`
|
||
ClientIP string `gorm:"size:64" json:"client_ip"`
|
||
Status string `gorm:"size:32" json:"status"` // active, closed, failed
|
||
Duration int `json:"duration"` // seconds
|
||
RecordData string `gorm:"type:mediumtext" json:"-"` // 终端录制原始输出(asciicast v2 格式,max 16MB)
|
||
RecordSize int `json:"record_size"` // 录制字节数
|
||
StartTime time.Time `json:"start_time"`
|
||
EndTime *time.Time `json:"end_time"`
|
||
CreatedAt time.Time `json:"created_at"`
|
||
}
|
||
|
||
// TableName 表名
|
||
func (TerminalSession) TableName() string {
|
||
return "sys_terminal_sessions"
|
||
}
|
||
|
||
// TerminalSessionQuery 终端会话查询
|
||
type TerminalSessionQuery struct {
|
||
ServerID uint `form:"server_id"`
|
||
Username string `form:"username"`
|
||
Status string `form:"status"`
|
||
Page int `form:"page,default=1"`
|
||
PageSize int `form:"page_size,default=20"`
|
||
}
|