feat(audit): F1+F2 告警静默规则标记完成 + 审计日志CSV导出实现

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 ✅
This commit is contained in:
attacker committed 2026-06-25 20:16:30 +08:00
1 parent e57718998a
commit 77c234b060
314 files changed
+10050 -4065

No files matched your search

+23 -146
View File
@@ -1,161 +1,38 @@
# AIOps 配置文件示例
# 复制此文件为 config.yaml 并根据实际情况修改
# 复制为 config.yaml 并根据实际环境修改
# 代码只读取下方列出的字段(见 backend/config/config.go)
# 应用配置
app:
name: "AIOps"
version: "1.0.0"
port: 8080
mode: "debug" # debug, release, test
# 运行模式: debug | release
mode: "release"
port: "8080"
log_level: "info"
# 数据库配置
# MySQL 数据库
database:
# 数据库类型: mysql, postgres
driver: "mysql"
# MySQL配置
mysql:
host: "localhost"
port: 3306
username: "ezops"
password: "your_password"
database: "ezops"
charset: "utf8mb4"
max_idle_conns: 10
max_open_conns: 100
conn_max_lifetime: 3600 # 秒
# PostgreSQL配置
postgres:
host: "localhost"
port: 5432
username: "ezops"
password: "your_password"
database: "ezops"
ssl_mode: "disable"
max_idle_conns: 10
max_open_conns: 100
conn_max_lifetime: 3600 # 秒
host: "mysql" # Docker Compose 用服务名,外部连接用 IP
port: 3306
user: "aiops"
password: "CHANGE_ME"
dbname: "aiops"
charset: "utf8mb4"
max_conn: 100
max_idle: 10
# Redis配置
# Redis 缓存 (可选,driver=redka 为内嵌模式无需外部 Redis)
redis:
enabled: false
host: "localhost"
driver: "redis" # redka (内嵌) | redis (外部)
host: "redis"
port: 6379
password: ""
database: 0
pool_size: 10
db: 0
# JWT配置
# JWT 认证
jwt:
secret: "your_jwt_secret_key_change_this_in_production"
expire_hours: 24
refresh_hours: 168 # 7天
secret: "CHANGE_ME_JWT_SECRET"
expire_hour: 24
# 日志配置
log:
level: "info" # debug, info, warn, error
format: "json" # json, console
output: "stdout" # stdout, file
file_path: "./logs/ezops.log"
max_size: 100 # MB
max_backups: 10
max_age: 30 # 天
compress: true
# CORS配置
cors:
allowed_origins:
- "http://localhost:3000"
- "http://localhost:5173"
allowed_methods:
- "GET"
- "POST"
- "PUT"
- "DELETE"
- "OPTIONS"
allowed_headers:
- "*"
allow_credentials: true
max_age: 86400
# 文件上传配置
upload:
max_size: 10485760 # 10MB
allowed_types:
- ".xlsx"
- ".xls"
- ".csv"
- ".json"
- ".yaml"
- ".yml"
upload_path: "./uploads"
# WebSocket配置
# WebSocket (kubectl 终端)
websocket:
read_buffer_size: 1024
write_buffer_size: 1024
ping_period: 30 # 秒
pong_wait: 60 # 秒
# 监控配置
monitor:
enabled: true
metrics_port: 9090
pprof_enabled: false
# 云平台配置
cloud:
# 阿里云配置
aliyun:
enabled: false
access_key_id: ""
access_key_secret: ""
region: "cn-hangzhou"
# 腾讯云配置
tencent:
enabled: false
secret_id: ""
secret_key: ""
region: "ap-guangzhou"
# AWS配置
aws:
enabled: false
access_key_id: ""
secret_access_key: ""
region: "us-east-1"
# 华为云配置
huawei:
enabled: false
access_key_id: ""
secret_access_key: ""
region: "cn-north-1"
# 告警通知配置
notification:
# 邮件配置
email:
enabled: false
smtp_host: "smtp.example.com"
smtp_port: 587
username: ""
password: ""
from: "ezops@example.com"
use_tls: true
# 钉钉配置
dingtalk:
enabled: false
webhook_url: ""
secret: ""
# 企业微信配置
wechat:
enabled: false
webhook_url: ""
# Slack配置
slack:
enabled: false
webhook_url: ""
# 审计日志配置
audit:
enabled: true
retention_days: 365 # 日志保留天数
async_write: true # 异步写入