feat: improve operational audit reliability
This commit is contained in:
1 parent
acbe64df00
commit
b7d9e6a4d9
10 files changed
+11601
-28
No files matched your search
@@ -76,6 +76,10 @@ interface AuditLog {
|
||||
path: string
|
||||
statusCode: number
|
||||
ipAddress?: string
|
||||
requestId?: string
|
||||
durationMilliseconds: number
|
||||
userAgent?: string
|
||||
errorType?: string
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
@@ -121,6 +125,7 @@ const auditFilter = reactive({
|
||||
statusCode: '',
|
||||
userName: '',
|
||||
path: '',
|
||||
requestId: '',
|
||||
range: [] as Date[],
|
||||
})
|
||||
|
||||
@@ -253,6 +258,7 @@ async function loadAudit() {
|
||||
if (auditFilter.statusCode) params.statusCode = Number(auditFilter.statusCode)
|
||||
if (auditFilter.userName.trim()) params.userName = auditFilter.userName.trim()
|
||||
if (auditFilter.path.trim()) params.path = auditFilter.path.trim()
|
||||
if (auditFilter.requestId.trim()) params.requestId = auditFilter.requestId.trim()
|
||||
if (auditFilter.range.length === 2) {
|
||||
params.from = auditFilter.range[0].toISOString()
|
||||
params.to = auditFilter.range[1].toISOString()
|
||||
@@ -319,6 +325,7 @@ function resetAudit() {
|
||||
statusCode: '',
|
||||
userName: '',
|
||||
path: '',
|
||||
requestId: '',
|
||||
range: [],
|
||||
})
|
||||
loadAudit()
|
||||
@@ -438,7 +445,7 @@ onMounted(refreshAll)
|
||||
</strong>
|
||||
<p>
|
||||
{{ summary?.counters.criticalAlerts ?? 0 }} 个严重告警 ·
|
||||
{{ summary?.counters.auditEvents24Hours ?? 0 }} 次写操作 / 24h
|
||||
{{ summary?.counters.auditEvents24Hours ?? 0 }} 条审计事件 / 24h
|
||||
</p>
|
||||
</div>
|
||||
<div class="signal-track">
|
||||
@@ -598,6 +605,7 @@ onMounted(refreshAll)
|
||||
<el-input v-model="auditFilter.statusCode" clearable placeholder="状态码,如 500" />
|
||||
<el-input v-model="auditFilter.userName" clearable placeholder="操作账号" />
|
||||
<el-input v-model="auditFilter.path" clearable placeholder="接口路径" />
|
||||
<el-input v-model="auditFilter.requestId" clearable placeholder="请求标识" />
|
||||
<el-date-picker
|
||||
v-model="auditFilter.range"
|
||||
type="datetimerange"
|
||||
@@ -628,11 +636,23 @@ onMounted(refreshAll)
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="耗时" width="96">
|
||||
<template #default="{ row }">{{ row.durationMilliseconds }} ms</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="ipAddress" label="来源 IP" width="142">
|
||||
<template #default="{ row }">{{ row.ipAddress || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="请求标识" min-width="160" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.requestId || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户端" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.userAgent || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="异常类型" min-width="150" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.errorType || '—' }}</template>
|
||||
</el-table-column>
|
||||
<template #empty>
|
||||
<span>该时间范围内没有匹配的写操作。</span>
|
||||
<span>该时间范围内没有匹配的写操作或失败请求。</span>
|
||||
</template>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@@ -1039,7 +1059,7 @@ onMounted(refreshAll)
|
||||
.query-strip {
|
||||
display: grid;
|
||||
gap: 9px;
|
||||
grid-template-columns: 120px 130px 150px minmax(170px, 1fr) 360px auto auto;
|
||||
grid-template-columns: 110px 120px 140px minmax(150px, 1fr) minmax(150px, 1fr) 320px auto auto;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user