{% extends "base.html" %} {% block title %}流量异常 - Squid Manager{% endblock %} {% block content %} {% if entries_count == 0 %}
🕵️

暂无日志数据

请先到 日志导入路径设置 配置 access.log。

{% else %}
⚙️ 阈值设置 (显示用, 修改后请回到此页面点击刷新)
当前 critical 阈值 = {{ thresholds.spike_crit_ratio }}x (固定) · 基线窗口 = 前 80%, 当前窗口 = 后 20%
突增客户端
{{ summary.anomalous_clients | length }}
请求速率突增 > {{ thresholds.spike_warn_ratio }}x
大文件请求
{{ summary.large_requests | length }}
单次响应 > {{ thresholds.large_size_mb }} MB
高频小包客户端
{{ summary.high_freq_small | length }}
响应 < {{ thresholds.small_size_kb }} KB 且请求数 ≥ {{ thresholds.min_small_requests }}
首次出现客户端
{{ summary.new_clients | length }}
本日志切片内首次见到的客户端

🔥 突增客户端 ({{ summary.anomalous_clients | length }} 条)

{% if summary.anomalous_clients %} {% for a in summary.anomalous_clients %} {% endfor %}
客户端 基线请求/分 当前请求/分 基线总数 当前总数 倍数 严重程度
{{ a.client }} {{ '%.2f' % a.baseline_rpm }} {{ '%.2f' % a.current_rpm }} {{ a.baseline_count }} {{ a.current_count }} {% if a.ratio == 'inf' or a.ratio == 'Infinity' or (a.ratio is number and a.ratio > 1e15) %} ∞ (基线为 0) {% else %} {{ '%.2f' % a.ratio }}x {% endif %} {{ a.severity }}
{% else %}

未检测到异常突增客户端。

{% endif %}

💾 异常大文件请求 ({{ summary.large_requests | length }} 条)

{% if summary.large_requests %} {% for r in summary.large_requests %} {% endfor %}
时间 客户端 大小 方法 状态 URL
{{ r.time }} {{ r.client }} {{ '%.2f' % r.size_mb }} MB ({{ r.size_bytes | thousands }} B) {{ r.method }} {{ r.result }} {{ r.url }} {% if r.host %}[{{ r.host }}]{% endif %}
{% else %}

未检测到 > {{ thresholds.large_size_mb }} MB 的请求。

{% endif %}

📊 高频小包客户端 ({{ summary.high_freq_small | length }} 个)

{% if summary.high_freq_small %} {% for c in summary.high_freq_small %} {% endfor %}
客户端 请求数 总流量 平均大小 示例主机 示例 URL
{{ c.client }} {{ c.request_count | thousands }} {{ c.total_bytes | thousands }} B {{ '%.0f' % c.avg_size }} B {{ c.sample_host or '-' }} {{ c.sample_url }}
{% else %}

未检测到符合条件 (< {{ thresholds.small_size_kb }} KB × ≥ {{ thresholds.min_small_requests }} 次) 的客户端。

{% endif %}

👋 首次出现客户端 ({{ summary.new_clients | length }} 个)

{% if summary.new_clients %} {% for c in summary.new_clients %} {% endfor %}
客户端 首次出现时间 本日志段请求数 示例 URL
{{ c.client }} {{ c.first_seen }} {{ c.request_count | thousands }} {{ c.sample_url }}
{% else %}

未检测到新出现的客户端。

{% endif %}
{% endif %} {% endblock %} {% block scripts %} {% endblock %}