Files
LokiStack/frontend/src/i18n/locales/zh/alerts.ts
T
opsx 7369a17598 feat(alerts): 数据库连接告警覆盖 MySQL/PG/Redis 主流报错;规则表单三字段对齐
=== 1. 「数据库连接失败」匹配模式 3 → 25 个 ===
原来只匹配 connection refused / reset by peer / too many connections,
漏掉了 PG 的 FATAL: too many clients、Redis 的 NOAUTH / WRONGPASS /
connection pool timeout 等实际最常见的报错。

按数据库分类补齐:
  通用网络层
    connection refused / connection reset by peer / broken pipe /
    no route to host / cannot assign requested address /
    connection timed out / i/o timeout / unexpected EOF /
    server closed the connection unexpectedly
  MySQL
    too many connections / communications link failure /
    driver: bad connection / could not create connection /
    Access denied for user
  PostgreSQL
    FATAL: password authentication failed / sorry, too many clients /
    terminating connection
  Redis
    NOAUTH / WRONGPASS / READONLY you can't write against /
    CLUSTERDOWN / max number of clients reached
  连接池(Java/Go 应用层最先炸的地方)
    connection pool / connection is not available

**刻意不加**的(会匹配到几乎所有网络日志,等于没告警):
   裸 "EOF"、"timeout"、"error"、"refused"、"deadlock"
阈值保持 1000/15min(模式变多不代表命中变多,都是真错误才命中)。

迁移 v9→v10 只替换"仍是旧默认查询"的规则,用户自定义过的不动。

=== 2. 规则表单三个字段没对齐 ===
现象:统计窗口(分) / 触发阈值(条) / 冷却(分) 三格并排,
但只有中间的「触发阈值」下方多了一行提示文字,
导致中间那格更高、提示文字悬在底部,看起来像没对齐。
修法:三格统一为「标签 + 输入框 + 一行提示(min-h-4 固定高度)」,
底边自然齐平;提示文案改为:
    统计窗口 → 统计最近多少分钟
    触发阈值 → 超过该条数才告警
    冷却    → 冷却内不重复发送
(顺带把阈值提示从"0 = 出现即告警"改掉:默认阈值已无 0,0 反而是危险配置)
小屏改单列堆叠(grid-cols-1 sm:grid-cols-3)。

=== 实测(936a127b1d15)===
  v10 迁移:告警规则 "数据库连接失败" 扩展匹配模式
  线上规则:25 个模式,含 NOAUTH / too many clients,阈值 1000,冷却 240m
  Pod = latest = v0.1 = 936a127b1d15
2026-10-29 03:56:07 +00:00

96 lines
3.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// alerts 命名空间 — 日志告警域中文文案(页头 / 规则表单与模板 / 发送历史 / 飞书通知提示)
export default {
title: '日志告警',
subtitle: '按 LogQL 计数规则监控日志,超阈值推送飞书卡片(周期 1 分钟)',
checkNow: '立即检查',
checking: '检查中...',
create: '新建规则',
emptyTitle: '暂无告警规则',
historyEmpty: '还没有发送记录。规则命中后会在这里留下投递结果。',
tabs: {
rules: '告警规则',
channels: '通知通道',
history: '发送历史',
},
notifySectionTitle: '通知通道(飞书 / Lark / Webhook)',
notifySectionConfigured: '已配置 {{count}} 个',
notifySectionEmpty: '尚未配置,告警发不出去',
col: {
enabled: '启用',
name: '规则',
condition: '条件',
notify: '通知',
},
emptyDesc: '例如:{namespace=~".+"} |= "FATAL",15 分钟内超过 0 条即推送飞书',
sourceFallback: '数据源 {{id}}',
noChannels: '未关联通道',
channelSep: '、',
ruleMeta: '{{window}} 分钟超过 {{threshold}} 条触发 · 冷却 {{cooldown}} 分钟',
lastFired: '上次触发 {{time}}',
editAria: '编辑 {{name}}',
deleteAria: '删除 {{name}}',
historyTitle: '发送历史(最近 50 条)',
notifyHintPre: '通知未配置?去',
notifyHintPost: '配置飞书 Webhook',
editTitle: '编辑规则 · {{name}}',
createTitle: '新建告警规则',
templates: '快捷模板(点击预填,可再修改)',
saving: '保存中...',
save: '保存修改',
submitCreate: '创建规则',
loadFailed: '加载告警数据失败',
saveFailed: '保存失败',
deleteFailed: '删除失败',
checkDone: '已执行一次检查,结果见发送历史',
checkFailed: '检查失败',
toggleFailed: '切换失败',
confirmDeleteTitle: '确认删除告警规则',
delivery: {
sent: '已发送',
cooldown: '冷却跳过',
failed: '失败',
hits: '{{count}} 条命中',
},
tpl: {
nsError: {
label: '业务 NS error',
desc: '指定命名空间(默认 astralx)内 error 日志',
},
allNsError: {
label: '全 NS error > 1000',
desc: '所有命名空间 error 日志总量超过 1000 条',
},
ingress5xx: {
label: 'Ingress 5xx',
desc: 'ingress-nginx 5xx(需 JSON access log,平台可一键标准化)',
},
ingress4xx: {
label: 'Ingress 4xx',
desc: 'ingress-nginx 4xx(需 JSON access log)',
},
fatal: {
label: 'FATAL',
desc: '所有命名空间出现 FATAL 即告警',
},
},
form: {
name: '规则名称 *',
namePlaceholder: '应用致命异常',
source: '数据源 *',
sourcePlaceholder: '选择数据源',
query: 'LogQL 查询 *',
queryHint:
'常用:{app="xxx"} |= "FATAL"',
channels: '通知通道(可多选,扇出到多个告警群)',
noChannels: '请先在「系统设置 → 告警通知」创建通道',
channelDisabled: '(禁用)',
window: '统计窗口(分)',
threshold: '触发阈值(条)',
windowHint: '统计最近多少分钟',
thresholdHint: '超过该条数才告警',
cooldown: '冷却(分)',
cooldownHint: '冷却内不重复发送',
enabled: '启用规则',
},
}