Nginx 日志分析可視化面板詳解
先看效果圖


實(shí)現(xiàn)效果
?? 全局變量說(shuō)明
在使用看板前,需了解以下兩個(gè)核心控制變量:
| 變量名 | 描述 | 技術(shù)實(shí)現(xiàn) |
|---|---|---|
| 網(wǎng)站 | 選擇目標(biāo)站點(diǎn)。 | 變量值直接映射為 ClickHouse 物理表名,實(shí)現(xiàn)多業(yè)務(wù)數(shù)據(jù)隔離。 |
| 時(shí)間粒度 | 設(shè)置指標(biāo)查詢的時(shí)間步長(zhǎng)。 | 用于控制趨勢(shì)圖的計(jì)算精度,粒度越小曲線越平滑,但查詢開銷越大。 |
?? 注意:本看板所有統(tǒng)計(jì)圖表均嚴(yán)格遵循 Grafana 右上角選定的時(shí)間范圍。
?? 一、流量概覽與趨勢(shì)
1. 請(qǐng)求趨勢(shì)
展示站點(diǎn)的核心負(fù)載情況。
- 指標(biāo):QPS (每秒查詢率)、平均響應(yīng)時(shí)間。
- 邏輯:數(shù)據(jù)精度受“時(shí)間粒度”變量控制。
2. 狀態(tài)碼分布
統(tǒng)計(jì)全量 HTTP 狀態(tài)碼的分布情況,用于快速判斷服務(wù)健康度(如 4xx 客戶端錯(cuò)誤或 5xx 服務(wù)端錯(cuò)誤)。
?? 二、上游服務(wù)監(jiān)控
針對(duì) Nginx 反向代理的后端服務(wù)進(jìn)行專項(xiàng)分析:
1. 上游平均響應(yīng)時(shí)長(zhǎng)
- 指標(biāo):后端服務(wù)器的平均響應(yīng)耗時(shí)。
- 說(shuō)明:此處不統(tǒng)計(jì) QPS。因?yàn)?Nginx 會(huì)根據(jù)負(fù)載均衡策略分發(fā)請(qǐng)求,單純統(tǒng)計(jì)上游 QPS 參考意義有限。
2. 上游異常狀態(tài)碼 TOP10
- 篩選:僅統(tǒng)計(jì)
>= 400的錯(cuò)誤狀態(tài)碼。 - 維度:展示具體是哪臺(tái)上游服務(wù)器的哪個(gè) URI 報(bào)錯(cuò)最多。
?? 三、TOP N 訪問(wèn)排行
| 統(tǒng)計(jì)項(xiàng) | 說(shuō)明 |
|---|---|
| URL TOP10 | 按訪問(wèn)量排序。已排除靜態(tài)資源,并對(duì)路徑參數(shù)進(jìn)行歸一化處理(如 /user/123 視為 /user/:id)。 |
| 來(lái)源 Referer TOP10 | 統(tǒng)計(jì)請(qǐng)求來(lái)源。若無(wú) Referer,則歸類為“直接訪問(wèn)”。 |
| 來(lái)源 IP TOP10 | 識(shí)別高頻訪問(wèn)源 IP。 |
| 來(lái)源 C段 TOP10 | 統(tǒng)計(jì) /24 網(wǎng)段(如 192.168.1.*)的訪問(wèn)密度,常用于識(shí)別機(jī)房爬蟲。 |
?? 歸一化邏輯:該處理在 Nginx 日志收集 Agent 階段完成定義,避免 URL 發(fā)散導(dǎo)致的統(tǒng)計(jì)失效。
?? 四、終端與地域分析
1. 終端設(shè)備分布
基于 User-Agent 進(jìn)行設(shè)備指紋識(shí)別(邏輯集成在 Grafana SQL 查詢中):
- 移動(dòng)端:
Mobile,Android,iPhone,iPad - 電腦端:
Windows,Macintosh,Linux,X11 - 其他:未匹配上述規(guī)則的流量。
2. 訪問(wèn)熱力圖 (Geo Map)
- 展示:根據(jù)客戶端 IP 的經(jīng)緯度在地圖上標(biāo)記訪問(wèn)密度。
- 精度:受限于當(dāng)前 GeoIP 庫(kù),目前僅支持國(guó)家級(jí)別定位。
?? GeoIP 庫(kù)說(shuō)明:
當(dāng)前使用GeoLite2-City.mmdb庫(kù)。由于數(shù)據(jù)較舊且未配置網(wǎng)絡(luò)回源查詢,暫不支持城市級(jí)統(tǒng)計(jì)。如有需求,可直接替換為更新更全的.mmdb文件。
?? 五、性能診斷與安全
1. 慢請(qǐng)求分析 (200請(qǐng)求平均耗時(shí) TOP10)
- 目的:排查具體哪個(gè)接口拖慢了整體服務(wù)。
- 篩選:僅統(tǒng)計(jì)返回狀態(tài)碼為
200的請(qǐng)求(排除錯(cuò)誤請(qǐng)求干擾),并按平均耗時(shí)倒序排列。 - 范圍:不包含靜態(tài)資源請(qǐng)求。
2. 疑似攻擊請(qǐng)求統(tǒng)計(jì)
- 邏輯:基于預(yù)定義的正則表達(dá)式規(guī)則集,匹配惡意掃描特征(如 SQL 注入、目錄遍歷、XSS 等)。
- 實(shí)現(xiàn):過(guò)濾規(guī)則在 日志收集階段 定義,有效降低存儲(chǔ)噪音并提前預(yù)警。
實(shí)現(xiàn)過(guò)程
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 庫(kù)下載地址: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 = ""
}
# =========================
# 識(shí)別攻擊邏輯可以在這里配置
# =========================
# =========================
# CRS 攻擊檢測(cè)
# =========================
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"
}
# =========================
# 掃描器識(shí)別
# =========================
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"
}
# =========================
# 風(fēng)險(xiǎn)等級(jí)
# =========================
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"
}
}
# ===============================
# 靜態(tài)資源識(shí)別,非靜態(tài)資源URI規(guī)范化
# ===============================
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
# ========================================
# 非靜態(tài)資源URI規(guī)范化,其他規(guī)范化邏輯再這里寫
# ========================================
# 先處理 /數(shù)字/
tmp = replace!(.uri, r'/\d+/', "/:id/")
# 再處理結(jié)尾 /數(shù)字
tmp = replace(tmp, r'/\d+$', "/:id")
# 統(tǒng)一 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認(rèn)證,如果clickhouse沒(méi)有配置CA認(rèn)證,可以不需要
# =============================================================
tls:
verify_certificate: true
ca_file: /etc/vector/rootCA.crt
batch:
max_events: 500
timeout_secs: 1
encoding:
timestamp_format: rfc33394. grafana 配置
grafana 上創(chuàng)建clickhouse的數(shù)據(jù)源,然后導(dǎo)入模板:
{
"__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": "平均響應(yīng)時(shí)間"
},
{
"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": "請(qǐng)求趨勢(shì)",
"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": "上游平均響應(yīng)時(shí)長(zhǎng)",
"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": "總計(jì)"
}
]
},
{
"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": "疑似攻擊請(qǐng)求數(shù)量",
"type": "stat"
},
{
"datasource": {
"type": "grafana-clickhouse-datasource",
"uid": "${DS_CK-LOGS}"
},
"description": "狀態(tài)碼大于等于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": "上游異常狀態(tài)碼TOP 10(請(qǐng)求次數(shù))",
"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(請(qǐng)求次數(shù))",
"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請(qǐng)求平均耗時(shí)(秒) 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 '移動(dòng)端'\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": "終端設(shè)備",
"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": "狀態(tài)碼情況",
"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": "來(lái)源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": "來(lái)源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 '直接輸入網(wǎng)址訪問(wè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": "來(lái)源(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": "平均請(qǐng)求耗時(shí)(秒)(不含靜態(tài)文件)",
"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": "訪客數(shù)(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": "訪問(wèn)熱力圖",
"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": "網(wǎng)站",
"name": "table_name",
"options": [],
"query": "show tables;",
"refresh": 2,
"regex": "",
"type": "query"
},
{
"allowCustomValue": true,
"current": {
"text": "100",
"value": "100"
},
"description": "設(shè)置指標(biāo)查詢的時(shí)間步長(zhǎng)(Step),用于調(diào)節(jié)趨勢(shì)圖中 QPS 及平均響應(yīng)時(shí)間的計(jì)算精度。",
"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
}到此這篇關(guān)于Nginx 日志分析可視化面板詳解的文章就介紹到這了,更多相關(guān)nginx 日志分析內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
比較完整的Nginx配置文件nginx.conf常用參數(shù)中文詳解
這篇文章主要介紹了比較完整的Nginx配置文件nginx.conf常用參數(shù)中文詳解,需要的朋友可以參考下2015-07-07
Nginx部署項(xiàng)目上傳文件報(bào)錯(cuò)413的解決方法
本文主要介紹了Nginx部署項(xiàng)目上傳文件報(bào)錯(cuò)413的解決方法,報(bào)錯(cuò)413是因?yàn)镹ginx對(duì)上傳大小做了限制,所以我們需要配置文件,下面就來(lái)解決這個(gè)問(wèn)題,感興趣的可以了解一下2024-03-03
使用Nginx搭建圖片服務(wù)器(windows環(huán)境下)
這篇文章主要介紹了使用Nginx搭建圖片服務(wù)器(windows環(huán)境下),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-06-06
使用nginx正向代理實(shí)現(xiàn)內(nèi)網(wǎng)域名轉(zhuǎn)發(fā)過(guò)程解析
這篇文章主要介紹了使用nginx正向代理實(shí)現(xiàn)內(nèi)網(wǎng)域名轉(zhuǎn)發(fā)過(guò)程解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-08-08
在Nginx服務(wù)器中配置針對(duì)TCP的負(fù)載均衡的方法
這篇文章主要介紹了在Nginx服務(wù)器中配置針對(duì)TCP的負(fù)載均衡的方法,另外還介紹了TCP負(fù)載均衡的執(zhí)行原理,需要的朋友可以參考下2015-12-12
利用Nginx實(shí)現(xiàn)一個(gè)IP部署多個(gè)網(wǎng)站
文章主要介紹了如何在一個(gè)服務(wù)器/一個(gè)IP地址上部署多個(gè)網(wǎng)站虛擬主機(jī)的方法,主要包括基于域名、端口和IP地址的區(qū)分方式,并詳細(xì)描述了Nginx的虛擬主機(jī)配置結(jié)構(gòu)和匹配優(yōu)先,此外,文章還提供了完整的多站點(diǎn)部署示例、限制方案以及管理命令速查,需要的朋友可以參考下2026-05-05

