先看效果图


实现效果
📊 全局变量说明
在使用看板前,需了解以下两个核心控制变量:
| 变量名 | 描述 | 技术实现 |
|---|---|---|
| 网站 | 选择目标站点。 | 变量值直接映射为 ClickHouse 物理表名,实现多业务数据隔离。 |
| 时间粒度 | 设置指标查询的时间步长。 | 用于控制趋势图的计算精度,粒度越小曲线越平滑,但查询开销越大。 |
⚠️ 注意:本看板所有统计图表均严格遵循 Grafana 右上角选定的时间范围。
📈 一、流量概览与趋势
1. 请求趋势
展示站点的核心负载情况。
- 指标:QPS (每秒查询率)、平均响应时间。
- 逻辑:数据精度受"时间粒度"变量控制。
2. 状态码分布
统计全量 HTTP 状态码的分布情况,用于快速判断服务健康度(如 4xx 客户端错误或 5xx 服务端错误)。
⚙️ 二、上游服务监控
针对 Nginx 反向代理的后端服务进行专项分析:
1. 上游平均响应时长
- 指标:后端服务器的平均响应耗时。
- 说明 :此处不统计 QPS。因为 Nginx 会根据负载均衡策略分发请求,单纯统计上游 QPS 参考意义有限。
2. 上游异常状态码 TOP10
- 筛选 :仅统计
>= 400的错误状态码。 - 维度:展示具体是哪台上游服务器的哪个 URI 报错最多。
🏆 三、TOP N 访问排行
| 统计项 | 说明 |
|---|---|
| URL TOP10 | 按访问量排序。已排除静态资源 ,并对路径参数进行归一化 处理(如 /user/123 视为 /user/:id)。 |
| 来源 Referer TOP10 | 统计请求来源。若无 Referer,则归类为"直接访问"。 |
| 来源 IP TOP10 | 识别高频访问源 IP。 |
| 来源 C段 TOP10 | 统计 /24 网段(如 192.168.1.*)的访问密度,常用于识别机房爬虫。 |
💡 归一化逻辑 :该处理在 Nginx 日志收集 Agent 阶段完成定义,避免 URL 发散导致的统计失效。
🌐 四、终端与地域分析
1. 终端设备分布
基于 User-Agent 进行设备指纹识别(逻辑集成在 Grafana SQL 查询中):
- 移动端 :
Mobile,Android,iPhone,iPad - 电脑端 :
Windows,Macintosh,Linux,X11 - 其他:未匹配上述规则的流量。
2. 访问热力图 (Geo Map)
- 展示:根据客户端 IP 的经纬度在地图上标记访问密度。
- 精度 :受限于当前 GeoIP 库,目前仅支持国家级别定位。
📍 GeoIP 库说明 :
当前使用
GeoLite2-City.mmdb库。由于数据较旧且未配置网络回源查询,暂不支持城市级统计 。如有需求,可直接替换为更新更全的.mmdb文件。
🔍 五、性能诊断与安全
1. 慢请求分析 (200请求平均耗时 TOP10)
- 目的:排查具体哪个接口拖慢了整体服务。
- 筛选 :仅统计返回状态码为
200的请求(排除错误请求干扰),并按平均耗时倒序排列。 - 范围:不包含静态资源请求。
2. 疑似攻击请求统计
- 逻辑:基于预定义的正则表达式规则集,匹配恶意扫描特征(如 SQL 注入、目录遍历、XSS 等)。
- 实现 :过滤规则在 日志收集阶段 定义,有效降低存储噪音并提前预警。
实现过程
1. Nginx 配置
nginx 格式化输出,这里直接用json输出,方便vector读取:
log_format access_json escape=json
'{'
'"time":"$time_iso8601",'
'"remote_addr":"$remote_addr",'
'"x_forwarded_for":"$http_x_forwarded_for",'
'"request_id":"$request_id",'
'"host":"$host",'
'"method":"$request_method",'
'"uri":"$uri",'
'"args":"$args",'
'"protocol":"$server_protocol",'
'"status":$status,'
'"body_bytes_sent":$body_bytes_sent,'
'"request_time":$request_time,'
'"upstream_time":"$upstream_response_time",'
'"upstream_status":"$upstream_status",'
'"upstream_addr":"$upstream_addr",'
'"referer":"$http_referer",'
'"user_agent":"$http_user_agent",'
'"accept":"$http_accept",'
'"accept_language":"$http_accept_language",'
'"accept_encoding":"$http_accept_encoding",'
'"connection":"$http_connection",'
'"scheme":"$scheme",'
'"ssl_protocol":"$ssl_protocol",'
'"ssl_cipher":"$ssl_cipher",'
'"server_name":"$server_name",'
'"pid":"$pid"'
'}';
2. clickhouse 配置
clickhouse 建表SQL:
CREATE TABLE sitename_nginx_access_logs
(
ingest_time DateTime DEFAULT now(),
parse_error String DEFAULT '',
`time` Nullable(DateTime),
`remote_addr` Nullable(String),
`x_forwarded_for` Nullable(String),
`request_id` Nullable(String),
`host` Nullable(String),
`method` Nullable(String),
`uri` Nullable(String),
`args` Nullable(String),
`protocol` Nullable(String),
`status` Nullable(UInt16),
`body_bytes_sent` Nullable(UInt64),
`request_time` Nullable(Float32),
`upstream_time` Nullable(Float32),
`upstream_status` Nullable(UInt16),
`upstream_addr` Nullable(String),
`referer` Nullable(String),
`user_agent` Nullable(String),
`accept` Nullable(String),
`accept_language` Nullable(String),
`accept_encoding` Nullable(String),
`connection` Nullable(String),
`scheme` Nullable(String),
`ssl_protocol` Nullable(String),
`ssl_cipher` Nullable(String),
`server_name` Nullable(String),
`pid` Nullable(UInt32),
`country` Nullable(String),
`city` Nullable(String),
`is_static` Nullable(UInt8),
`ip_c` Nullable(String),
`attack_score` Nullable(UInt8),
`attack_type` Nullable(String),
`attack_level` Nullable(String),
`geo_lat` Nullable(String),
`geo_lon` Nullable(String),
`uri_normalized` Nullable(String),
INDEX idx_uri_normalized uri_normalized TYPE bloom_filter GRANULARITY 1,
INDEX idx_ip_c ip_c TYPE bloom_filter GRANULARITY 1,
INDEX idx_attack_level attack_level TYPE bloom_filter GRANULARITY 1
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(ingest_time)
ORDER BY (ingest_time)
TTL ingest_time + INTERVAL 180 DAY
SETTINGS index_granularity = 8192;
3. vector 配置
geoip 库下载地址:https://cdn.jsdelivr.net/npm/geolite2-city@1.0.67/
vector 配置文件
# ===============================
# GeoIP,提前下载GEOIP,放在这里
# ===============================
enrichment_tables:
geoip_table:
type: geoip
path: /etc/vector/GeoLite2-City.mmdb
# =========================
# Source: Nginx JSON 日志
# =========================
sources:
nginx_logs:
type: file
include:
- /var/log/nginx/*.json
ignore_older: 86400
fingerprinting:
strategy: "device_and_inode"
# =========================
# Transform: JSON 解码
# =========================
transforms:
parse_json:
type: remap
inputs: [nginx_logs]
source: |
# ---------- JSON ----------
if !exists(.message) {
null
}
# ---------- JSON ----------
., err = parse_json(.message)
if err != null {
.parse_error = .
abort
}
if !exists(.uri) {
null
}
if .time == null {
null
}
parsed_timestamp, err = parse_timestamp(.time, format: "%Y-%m-%dT%H:%M:%S%:z")
# Check if the conversion was successful. Note here that all errors must be handled, more on that later.
if err == null {
# Note that the `to_unix_timestamp` expects a `timestamp` argument.
# The following will compile because `parse_timestamp` returns a `timestamp`.
.time = to_unix_timestamp(parsed_timestamp)
} else {
.parse_error,_ = join([string!(.parse_error), "time_parse_failed",string!(parsed_timestamp)], ",")
# Conversion failed, in this case use the current time.
.time = null
}
# ---------- status ----------
val, err = to_int(.status)
if err != null {
.parse_error, _ = join([string!(.parse_error), "status_parse_failed",string!(.status)], ",")
.status = null
} else {
.status = val
}
# ---------- body_bytes_sent ----------
val, err = to_int(.body_bytes_sent)
if err != null && .status == 200 {
.parse_error, _ = join([string!(.parse_error), "body_bytes_sent_parse_failed",string!(.body_bytes_sent)], ",")
.body_bytes_sent = null
} else {
.body_bytes_sent = val
}
# ---------- request_time ----------
val, err = to_float(.request_time)
if err != null && .status == 200 {
.parse_error, _ = join([string!(.parse_error), "request_time_parse_failed",string!(.request_time)], ",")
.request_time = null
} else {
.request_time = val
}
# ---------- pid ----------
val, err = to_int(.pid)
if err != null {
.parse_error, _ = join([string!(.parse_error), "pid_parse_failed",string!(.pid)], ",")
.pid = null
} else {
.pid = val
}
# ---------- upstream_time ----------
val, err = to_float(.upstream_time)
if err != null && .status == 200 {
.parse_error, _ = join([string!(.parse_error), "upstream_time_parse_failed",string!(.upstream_time)], ",")
.upstream_time = null
} else {
.upstream_time = val
}
# ---------- upstream_status ----------
val, err = to_int(.upstream_status)
if err != null && .status == 200 {
.parse_error, _ = join([string!(.parse_error), "upstream_status_parse_failed",string!(.upstream_status)], ",")
.upstream_status = null
} else {
.upstream_status = val
}
# =========================
# GEOIP
# =========================
geo = get_enrichment_table_record!("geoip_table", {
"ip": .remote_addr
})
if geo != null {
.country = geo.country_name
.city = .geo.city_name
.geo_lat = geo.latitude
.geo_lon = geo.longitude
} else {
.geo_country = ""
.geo_city = ""
}
# =========================
# 识别攻击逻辑可以在这里配置
# =========================
# =========================
# CRS 攻击检测
# =========================
payload,err = .uri + " " + .args + " " + .user_agent
payload = downcase(string(payload))
.attack_score = 0
.attack_type = ""
# =========================
# SQLi
# =========================
if match_any(payload, [
r'union select',
r'or 1=1',
r'sleep\(',
r'benchmark\(',
r'information_schema'
]) {
.attack_score = .attack_score + 30
.attack_type = "sqli"
}
if match_any(payload, [
r'--',
r'#',
r'drop table',
r'delete from',
r'insert into'
]) {
.attack_score = .attack_score + 20
}
# =========================
# XSS
# =========================
if match_any(payload, [
r'<script',
r'onerror=',
r'onload=',
r'javascript:',
r'document.cookie'
]) {
.attack_score = .attack_score + 25
.attack_type = "xss"
}
# =========================
# RCE
# =========================
if match_any(payload, [
r'curl',
r'wget',
r'bash',
r'sh -c',
r'nc -e',
r'powershell'
]) {
.attack_score = .attack_score + 40
.attack_type = "rce"
}
# =========================
# 扫描器识别
# =========================
if match_any(string!(.user_agent), [
r'sqlmap',
r'nmap',
r'nikto',
r'burp',
r'acunetix'
]) {
.attack_score = .attack_score + 50
.attack_type = "scanner"
}
# =========================
# LFI / Path Traversal
# =========================
if match_any(payload, [
r'\.\./',
r'/etc/passwd',
r'windows\\system32',
r'proc/self'
]) {
.attack_score = .attack_score + 35
.attack_type = "lfi"
}
# =========================
# 风险等级
# =========================
if .attack_score >= 80 {
.attack_level = "critical"
} else if .attack_score >= 50 {
.attack_level = "high"
} else if .attack_score >= 20 {
.attack_level = "medium"
} else {
.attack_level = "low"
}
# =========================
# IP /24 归一化
# =========================
ip = .remote_addr
if ip != null {
parts = split(string!(ip), ".")
if length(parts) == 4 {
.ip_c, err = join([parts[0], parts[1], parts[2], "0/24"], ".")
if err != null {
.ip_c = "unknown"
}
} else {
.ip_c = "unknown"
}
}
# ===============================
# 静态资源识别,非静态资源URI规范化
# ===============================
if match_any(string!(.uri), [
r'\.css',
r'\.js',
r'\.png',
r'\.jpg',
r'\.jpeg',
r'\.gif',
r'\.ico',
r'\.svg',
r'\.woff',
r'\.ttf'
]){
.is_static = true
.uri_normalized = .uri
} else {
.is_static = false
# ========================================
# 非静态资源URI规范化,其他规范化逻辑再这里写
# ========================================
# 先处理 /数字/
tmp = replace!(.uri, r'/\d+/', "/:id/")
# 再处理结尾 /数字
tmp = replace(tmp, r'/\d+$', "/:id")
# 统一 UUID
.uri_normalized = replace(tmp, r'/[0-9a-fA-F-]{36}', "/:uuid")
}
# =========================
# Sink: ClickHouse
# =========================
sinks:
clickhouse:
type: clickhouse
inputs: [parse_json]
endpoint: "https://IP:POART"
database: default
table: sitename_nginx_access_logs
auth:
strategy: basic
user: <CK_USER>
password: <CK_PASS>
compression: gzip
# =============================================================
# 为了安全,配置了CA认证,如果clickhouse没有配置CA认证,可以不需要
# =============================================================
tls:
verify_certificate: true
ca_file: /etc/vector/rootCA.crt
batch:
max_events: 500
timeout_secs: 1
encoding:
timestamp_format: rfc3339
4. grafana 配置
grafana 上创建clickhouse的数据源,然后导入模板:
json
{
"__inputs": [
{
"name": "DS_CK-LOGS",
"label": "ck-logs",
"description": "",
"type": "datasource",
"pluginId": "grafana-clickhouse-datasource",
"pluginName": "ClickHouse"
},
{
"name": "DS_EXPRESSION",
"label": "Expression",
"description": "",
"type": "datasource",
"pluginId": "__expr__"
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 0,
"links": [],
"panels": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "smooth",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"showValues": false,
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "qps"
},
"properties": [
{
"id": "unit",
"value": "reqps"
},
{
"id": "custom.axisPlacement",
"value": "right"
},
{
"id": "custom.barAlignment",
"value": 0
},
{
"id": "custom.drawStyle",
"value": "line"
},
{
"id": "custom.barWidthFactor",
"value": 1
},
{
"id": "custom.fillOpacity",
"value": 26
},
{
"id": "color",
"value": {
"fixedColor": "dark-green",
"mode": "fixed"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "avg_time_sec"
},
"properties": [
{
"id": "displayName",
"value": "平均响应时间"
},
{
"id": "custom.lineWidth",
"value": 2
},
{
"id": "color",
"value": {
"fixedColor": "yellow",
"mode": "fixed",
"seriesBy": "last"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 11,
"x": 0,
"y": 0
},
"id": 14,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n toDateTime(\r\n intDiv(toUnixTimestamp(ingest_time), step) * step\r\n ) AS time_window,\r\n round(avg(request_time), 3) AS avg_time_sec,\r\n round(count(*) / any(step), 2) AS qps\r\nFROM \"default\".\"$table_name\"\r\nCROSS JOIN (\r\n SELECT\r\n ($__toTime - $__fromTime) / ${step} AS step\r\n) AS _params\r\nWHERE ingest_time BETWEEN toDateTime($__fromTime)\r\n AND toDateTime($__toTime)\r\nGROUP BY time_window\r\nORDER BY time_window;",
"refId": "A"
}
],
"title": "请求趋势",
"type": "timeseries"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"showValues": false,
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"displayName": "${__field.labels.upstream}",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 10,
"x": 11,
"y": 0
},
"id": 13,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 0,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "timeseries",
"rawSql": "SELECT\r\n toDateTime(\r\n intDiv(toUnixTimestamp(ingest_time), step) * step\r\n ) AS time,\r\n upstream_addr AS upstream,\r\n round(avg(upstream_time), 3) AS avg_upstream_time_sec\r\nFROM default.$table_name\r\nCROSS JOIN (\r\n SELECT ($__toTime - $__fromTime) / ${step} AS step\r\n) AS _params\r\nWHERE ( time >= $__fromTime AND time <= $__toTime ) \r\n AND upstream_addr IS NOT NULL\r\n AND upstream_addr != ''\r\n AND upstream_time IS NOT NULL\r\nGROUP BY time, upstream\r\nORDER BY time, upstream DESC;",
"refId": "A"
}
],
"title": "上游平均响应时长",
"type": "timeseries"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID",
"options": "A"
},
"properties": [
{
"id": "displayName",
"value": "总计"
}
]
},
{
"matcher": {
"id": "byFrameRefID",
"options": "B"
},
"properties": [
{
"id": "displayName",
"value": "medium"
}
]
},
{
"matcher": {
"id": "byFrameRefID",
"options": "C"
},
"properties": [
{
"id": "displayName",
"value": "high"
}
]
},
{
"matcher": {
"id": "byFrameRefID",
"options": "D"
},
"properties": [
{
"id": "displayName",
"value": "critical"
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 3,
"x": 21,
"y": 0
},
"id": 16,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT count(*) FROM \"default\".\"$table_name\" WHERE (is_static = 0 and time >= $__fromTime AND time <= $__toTime ) and attack_score >0",
"refId": "A"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"hide": false,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT count(*) FROM \"default\".\"$table_name\" WHERE (is_static = 0 and time >= $__fromTime AND time <= $__toTime ) and attack_level = 'medium'",
"refId": "B"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"hide": false,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT count(*) FROM \"default\".\"$table_name\" WHERE (is_static = 0 and time >= $__fromTime AND time <= $__toTime ) and attack_level = 'high'",
"refId": "C"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"hide": false,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT count(*) FROM \"default\".\"$table_name\" WHERE (is_static = 0 and time >= $__fromTime AND time <= $__toTime ) and attack_level = 'critical'",
"refId": "D"
}
],
"title": "疑似攻击请求数量",
"type": "stat"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"description": "状态码大于等于400",
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 14,
"w": 7,
"x": 0,
"y": 7
},
"id": 15,
"options": {
"displayMode": "gradient",
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"maxVizHeight": 300,
"minVizHeight": 16,
"minVizWidth": 8,
"namePlacement": "top",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"allValues"
],
"fields": "/.*/",
"values": true
},
"showUnfilled": true,
"sizing": "auto",
"valueMode": "color"
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n uri,\r\n upstream_addr,\r\n count(*) AS cnt\r\nFROM default.$table_name\r\nWHERE request_time IS NOT NULL and( time >= $__fromTime AND time <= $__toTime ) and upstream_status is not null and upstream_status >=400 \r\nGROUP BY uri,upstream_addr\r\nORDER BY cnt DESC\r\nLIMIT 10;",
"refId": "A"
}
],
"title": "上游异常状态码TOP 10(请求次数)",
"transformations": [
{
"id": "rowsToFields",
"options": {
"mappings": [
{
"fieldName": "cnt",
"handlerKey": "field.value"
},
{
"fieldName": "uri",
"handlerKey": "field.label"
},
{
"fieldName": "upstream_addr",
"handlerKey": "field.name"
}
]
}
}
],
"type": "bargauge"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 14,
"w": 6,
"x": 7,
"y": 7
},
"id": 8,
"options": {
"displayMode": "gradient",
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"maxVizHeight": 300,
"minVizHeight": 16,
"minVizWidth": 8,
"namePlacement": "top",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"allValues"
],
"fields": "/.*/",
"values": true
},
"showUnfilled": true,
"sizing": "auto",
"valueMode": "color"
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n uri_normalized,\r\n count(*) AS cnt\r\nFROM default.$table_name\r\nWHERE (is_static = 0 OR is_static IS NULL)\r\n AND request_time IS NOT NULL and( time >= $__fromTime AND time <= $__toTime ) \r\nGROUP BY uri_normalized\r\nORDER BY cnt DESC\r\nLIMIT 10;",
"refId": "A"
}
],
"title": "URL TOP 10(请求次数)",
"transformations": [
{
"id": "rowsToFields",
"options": {
"mappings": []
}
}
],
"type": "bargauge"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 1
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 14,
"w": 8,
"x": 13,
"y": 7
},
"id": 9,
"options": {
"displayMode": "gradient",
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"maxVizHeight": 300,
"minVizHeight": 16,
"minVizWidth": 8,
"namePlacement": "top",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"allValues"
],
"fields": "/.*/",
"values": true
},
"showUnfilled": true,
"sizing": "auto",
"valueMode": "color"
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n uri_normalized ,\r\n round(avg(request_time), 3) AS avg_time_sec\r\nFROM default.$table_name\r\nWHERE (is_static = 0 OR is_static IS NULL)\r\n AND request_time IS NOT NULL and( time >= $__fromTime AND time <= $__toTime ) and status == 200\r\nGROUP BY uri_normalized \r\nORDER BY avg_time_sec DESC\r\nLIMIT 10;",
"refId": "A"
}
],
"title": "200请求平均耗时(秒) TOP10",
"transformations": [
{
"id": "rowsToFields",
"options": {
"mappings": []
}
}
],
"type": "bargauge"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": []
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 3,
"x": 21,
"y": 7
},
"id": 5,
"options": {
"displayLabels": [
"percent",
"value"
],
"legend": {
"displayMode": "table",
"placement": "bottom",
"showLegend": true,
"values": [
"value",
"percent"
]
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "/^cnt$/",
"values": true
},
"sort": "desc",
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n CASE\r\n WHEN user_agent LIKE '%Mobile%' OR\r\n user_agent LIKE '%Android%' OR\r\n user_agent LIKE '%iPhone%' OR\r\n user_agent LIKE '%iPad%'\r\n THEN '移动端'\r\n WHEN user_agent LIKE '%Windows%' OR\r\n user_agent LIKE '%Macintosh%' OR\r\n user_agent LIKE '%Linux%' OR\r\n user_agent LIKE '%X11%'\r\n THEN '电脑端'\r\n ELSE '其他'\r\n END AS device_type,\r\n count(*) AS cnt\r\nFROM default.$table_name\r\nwhere ( time >= $__fromTime AND time <= $__toTime ) \r\nGROUP BY device_type\r\nORDER BY cnt DESC;",
"refId": "A"
}
],
"title": "终端设备",
"type": "piechart"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"fieldMinMax": false,
"mappings": []
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 3,
"x": 21,
"y": 16
},
"id": 4,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"pieType": "pie",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"sort": "desc",
"tooltip": {
"hideZeros": false,
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n status as metric,\r\n count(*) AS hit_count\r\nFROM\r\n \"default\".\"$table_name\"\r\nWHERE\r\n (\r\n time >= $__fromTime\r\n AND time <= $__toTime\r\n )\r\n and status IS NOT NULL\r\ngroup by\r\n status\r\norder by\r\n hit_count desc\r\nLIMIT\r\n 1000",
"refId": "A"
}
],
"title": "状态码情况",
"transformations": [
{
"id": "rowsToFields",
"options": {
"mappings": [
{
"fieldName": "metric",
"handlerKey": "field.name"
},
{
"fieldName": "hit_count",
"handlerKey": "field.value"
}
]
}
}
],
"type": "piechart"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 13,
"w": 7,
"x": 0,
"y": 21
},
"id": 12,
"options": {
"displayMode": "gradient",
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right",
"showLegend": false
},
"maxVizHeight": 300,
"minVizHeight": 0,
"minVizWidth": 8,
"namePlacement": "top",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"allValues"
],
"fields": "/.*/",
"limit": 10,
"values": true
},
"showUnfilled": true,
"sizing": "manual",
"text": {
"valueSize": 15
},
"valueMode": "text"
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n remote_addr,\r\n count(*) AS cnt\r\nFROM default.$table_name\r\nWHERE ( time >= $__fromTime AND time <= $__toTime ) \r\nGROUP BY remote_addr\r\nORDER BY cnt DESC\r\nLIMIT 10;",
"refId": "A"
}
],
"title": "来源IP TOP 10",
"transformations": [
{
"id": "rowsToFields",
"options": {
"mappings": []
}
}
],
"type": "bargauge"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 13,
"w": 6,
"x": 7,
"y": 21
},
"id": 11,
"options": {
"displayMode": "gradient",
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right",
"showLegend": false
},
"maxVizHeight": 300,
"minVizHeight": 0,
"minVizWidth": 8,
"namePlacement": "top",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"allValues"
],
"fields": "/.*/",
"limit": 10,
"values": true
},
"showUnfilled": true,
"sizing": "manual",
"text": {
"valueSize": 15
},
"valueMode": "text"
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n ip_c,\r\n count(*) AS cnt\r\nFROM default.$table_name\r\nWHERE ( time >= $__fromTime AND time <= $__toTime ) \r\nGROUP BY ip_c\r\nORDER BY cnt DESC\r\nLIMIT 10;",
"refId": "A"
}
],
"title": "来源C段 TOP 10",
"transformations": [
{
"id": "rowsToFields",
"options": {
"mappings": []
}
}
],
"type": "bargauge"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"fieldMinMax": false,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 13,
"w": 8,
"x": 13,
"y": 21
},
"id": 10,
"options": {
"displayMode": "gradient",
"legend": {
"calcs": [
"lastNotNull"
],
"displayMode": "table",
"placement": "right",
"showLegend": false
},
"maxVizHeight": 300,
"minVizHeight": 0,
"minVizWidth": 8,
"namePlacement": "top",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"allValues"
],
"fields": "/.*/",
"limit": 10,
"values": true
},
"showUnfilled": true,
"sizing": "manual",
"text": {},
"valueMode": "text"
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT\r\n if(\r\n referer IS NULL OR referer = '',\r\n '直接输入网址访问',\r\n referer\r\n ) AS referer,\r\n count(*) AS cnt\r\nFROM default.$table_name\r\nWHERE ( time >= $__fromTime AND time <= $__toTime ) \r\nGROUP BY referer\r\nORDER BY cnt DESC\r\nLIMIT 10;",
"refId": "A"
}
],
"title": "来源(Referer)TOP 10",
"transformations": [
{
"id": "rowsToFields",
"options": {
"mappings": []
}
}
],
"type": "bargauge"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 21,
"y": 25
},
"id": 6,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT avg(request_time) AS avg_request_time_sec FROM \"default\".\"$table_name\" WHERE (is_static = 0 and time >= $__fromTime AND time <= $__toTime ) LIMIT 1000",
"refId": "A"
}
],
"title": "平均请求耗时(秒)(不含静态文件)",
"type": "stat"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 21,
"y": 28
},
"id": 2,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.3.2",
"targets": [
{
"builderOptions": {
"aggregates": [],
"columns": [],
"database": "default",
"filters": [
{
"condition": "AND",
"filterType": "custom",
"key": "time",
"label": "time",
"operator": "WITH IN DASHBOARD TIME RANGE",
"type": "Nullable(DateTime)",
"value": "TODAY"
}
],
"groupBy": [],
"limit": 1000,
"meta": {},
"mode": "list",
"orderBy": [],
"queryType": "table",
"table": ""
},
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"aggregates": [],
"columns": [],
"database": "default",
"filters": [
{
"condition": "AND",
"filterType": "custom",
"key": "time",
"label": "time",
"operator": "WITH IN DASHBOARD TIME RANGE",
"type": "Nullable(DateTime)",
"value": "TODAY"
}
],
"groupBy": [],
"limit": 1000,
"meta": {},
"mode": "list",
"orderBy": [],
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT count(*) FROM \"default\".\"$table_name\" WHERE ( time >= $__fromTime AND time <= $__toTime ) LIMIT 1000",
"refId": "A"
}
],
"title": "浏览量(PV)",
"type": "stat"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 3,
"x": 21,
"y": 31
},
"id": 3,
"options": {
"colorMode": "value",
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.3.2",
"targets": [
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"columns": [],
"database": "",
"limit": 1000,
"mode": "list",
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT count(DISTINCT remote_addr) FROM \"default\".\"$table_name\" WHERE ( time >= $__fromTime AND time <= $__toTime ) LIMIT 1000",
"refId": "A"
}
],
"title": "访客数(UV)",
"type": "stat"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": 0
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 20,
"w": 24,
"x": 0,
"y": 34
},
"id": 1,
"options": {
"basemap": {
"config": {},
"name": "Layer 0",
"noRepeat": false,
"type": "default"
},
"controls": {
"mouseWheelZoom": true,
"showAttribution": true,
"showDebug": false,
"showMeasure": false,
"showScale": false,
"showZoom": true
},
"layers": [
{
"config": {
"blur": 15,
"radius": 5,
"weight": {
"fixed": 1,
"max": 1,
"min": 0
}
},
"location": {
"mode": "auto"
},
"name": "Layer 2",
"opacity": 0.4,
"tooltip": true,
"type": "heatmap"
}
],
"tooltip": {
"mode": "details"
},
"view": {
"allLayers": true,
"id": "zero",
"lat": 0,
"lon": 0,
"noRepeat": false,
"zoom": 1
}
},
"pluginVersion": "12.3.2",
"targets": [
{
"builderOptions": {
"aggregates": [],
"columns": [
{
"alias": "geo_lat",
"custom": false,
"name": "geo_lat",
"type": "Nullable(String)"
},
{
"alias": "geo_lon",
"custom": false,
"name": "geo_lon",
"type": "Nullable(String)"
}
],
"database": "default",
"filters": [
{
"key": "time",
"operator": "WITH IN DASHBOARD TIME RANGE",
"type": "datetime"
}
],
"groupBy": [],
"limit": 1000,
"meta": {},
"mode": "list",
"orderBy": [],
"queryType": "table",
"table": ""
},
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"editorType": "sql",
"format": 1,
"meta": {
"builderOptions": {
"aggregates": [],
"columns": [
{
"alias": "geo_lat",
"custom": false,
"name": "geo_lat",
"type": "Nullable(String)"
},
{
"alias": "geo_lon",
"custom": false,
"name": "geo_lon",
"type": "Nullable(String)"
}
],
"database": "default",
"filters": [
{
"key": "time",
"operator": "WITH IN DASHBOARD TIME RANGE",
"type": "datetime"
}
],
"groupBy": [],
"limit": 1000,
"meta": {},
"mode": "list",
"orderBy": [],
"queryType": "table",
"table": ""
}
},
"pluginVersion": "4.17.0",
"queryType": "table",
"rawSql": "SELECT geo_lat as lat, geo_lon as lon FROM \"default\".\"$table_name\" WHERE ( time >= $__fromTime AND time <= $__toTime ) LIMIT 1000",
"refId": "A"
}
],
"title": "访问热力图",
"type": "geomap"
}
],
"preload": false,
"schemaVersion": 42,
"tags": [],
"templating": {
"list": [
{
"allowCustomValue": false,
"current": {
"text": "",
"value": ""
},
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"definition": "show tables;",
"description": "clickhouse中的table name",
"label": "网站",
"name": "table_name",
"options": [],
"query": "show tables;",
"refresh": 2,
"regex": "",
"type": "query"
},
{
"allowCustomValue": true,
"current": {
"text": "100",
"value": "100"
},
"description": "设置指标查询的时间步长(Step),用于调节趋势图中 QPS 及平均响应时间的计算精度。",
"label": "颗粒度",
"name": "step",
"options": [
{
"selected": true,
"text": "100",
"value": "100"
},
{
"selected": false,
"text": "200",
"value": "200"
},
{
"selected": false,
"text": "500",
"value": "500"
},
{
"selected": false,
"text": "1000",
"value": "1000"
}
],
"query": "100, 200, 500, 1000",
"type": "custom"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "日志",
"uid": "adhmzrx",
"version": 37
}