测试ingress

这篇博客展示了如何使用Loki日志管理系统,结合Grafana仪表板,对NGINX访问日志进行深度分析。内容包括请求状态码分布、5xx错误率、总字节数发送、国家分布、请求延迟95th百分位及最常请求页面等关键指标的实时监控。通过对这些数据的可视化展示,可以有效地了解网站性能和用户体验。
摘要由CSDN通过智能技术生成

{
“annotations”: {
“list”: [
{
“builtIn”: 1,
“datasource”: “-- Grafana --”,
“enable”: true,
“hide”: true,
“iconColor”: “rgba(0, 211, 255, 1)”,
“name”: “Annotations & Alerts”,
“type”: “dashboard”
}
]
},
“description”: “Loki version 2 showcase using JSON NGINX access logs.”,
“editable”: true,
“gnetId”: 12559,
“graphTooltip”: 0,
“id”: 26,
“links”: [],
“panels”: [
{
“collapsed”: false,
“datasource”: “Loki”,
“gridPos”: {
“h”: 1,
“w”: 24,
“x”: 0,
“y”: 0
},
“id”: 24,
“panels”: [],
“title”: “KPI’s”,
“type”: “row”
},
{
“datasource”: “Loki”,
“description”: “”,
“fieldConfig”: {
“defaults”: {
“custom”: {
“align”: null
},
“mappings”: [],
“thresholds”: {
“mode”: “absolute”,
“steps”: [
{
“color”: “purple”,
“value”: null
}
]
},
“unit”: “short”
},
“overrides”: []
},
“gridPos”: {
“h”: 4,
“w”: 6,
“x”: 0,
“y”: 1
},
“id”: 4,
“interval”: “30s”,
“options”: {
“colorMode”: “background”,
“graphMode”: “area”,
“justifyMode”: “center”,
“orientation”: “auto”,
“reduceOptions”: {
“calcs”: [
“sum”
],
“fields”: “”,
“values”: false
},
“textMode”: “value”
},
“pluginVersion”: “7.3.5”,
“targets”: [
{
“expr”: “count_over_time({filename=”/var/log/nginx/access.log"}[KaTeX parse error: Expected group after '_' at position 1: _̲_interval])", …__interval]))",
“legendFormat”: “HTTP Status: {{httpRequest_status}}”,
“refId”: “A”
}
],
“timeFrom”: null,
“timeShift”: null,
“title”: “Requests per status code”,
“transformations”: [],
“type”: “stat”
},
{
“cacheTimeout”: null,
“datasource”: “Loki”,
“description”: “”,
“fieldConfig”: {
“defaults”: {
“custom”: {
“align”: null
},
“mappings”: [],
“thresholds”: {
“mode”: “absolute”,
“steps”: [
{
“color”: “purple”,
“value”: null
},
{
“color”: “red”,
“value”: 80
}
]
},
“unit”: “percent”
},
“overrides”: []
},
“gridPos”: {
“h”: 4,
“w”: 5,
“x”: 15,
“y”: 1
},
“id”: 19,
“interval”: null,
“links”: [],
“maxDataPoints”: 1,
“options”: {
“colorMode”: “background”,
“graphMode”: “none”,
“justifyMode”: “center”,
“orientation”: “auto”,
“reduceOptions”: {
“calcs”: [
“mean”
],
“fields”: “”,
“values”: false
},
“textMode”: “value”
},
“pluginVersion”: “7.3.5”,
“targets”: [
{
“expr”: " sum(rate({filename="/var/log/nginx/access.log"} | json | httpRequest_status >= 500 |error=""[KaTeX parse error: Expected group after '_' at position 1: _̲_interval])) / …__interval])) / 100)",
“legendFormat”: “”,
“refId”: “A”
}
],
“timeFrom”: null,
“timeShift”: null,
“title”: “% of 5xx requests “,
“type”: “stat”
},
{
“cacheTimeout”: null,
“datasource”: “Loki”,
“description”: “”,
“fieldConfig”: {
“defaults”: {
“custom”: {
“align”: null
},
“mappings”: [],
“thresholds”: {
“mode”: “absolute”,
“steps”: [
{
“color”: “purple”,
“value”: null
}
]
},
“unit”: “percent”
},
“overrides”: []
},
“gridPos”: {
“h”: 4,
“w”: 4,
“x”: 20,
“y”: 1
},
“id”: 18,
“interval”: “10m”,
“links”: [],
“maxDataPoints”: 1,
“options”: {
“colorMode”: “background”,
“graphMode”: “none”,
“justifyMode”: “auto”,
“orientation”: “auto”,
“reduceOptions”: {
“calcs”: [
“last”
],
“fields”: “”,
“values”: false
},
“textMode”: “value”
},
“pluginVersion”: “7.3.5”,
“targets”: [
{
“expr”: " sum(rate(({job=“nginx_access_log”} |= “Googlebot”)[KaTeX parse error: Expected group after '_' at position 1: _̲_interval])) / …__interval])”,
“legendFormat”: “Bytes sent”,
“refId”: “A”
}
],
“timeFrom”: null,
“timeShift”: null,
“title”: “Total Bytes Sent”,
“transformations”: [
{
“id”: “reduce”,
“options”: {
“reducers”: [
“sum”
]
}
},
{
“id”: “organize”,
“options”: {
“excludeByName”: {},
“indexByName”: {},
“renameByName”: {
“Total”: “Bytes Sent”
}
}
}
],
“type”: “stat”
},
{
“circleMaxSize”: “50”,
“circleMinSize”: “15”,
“colors”: [
“#96D98D”,
“#37872D”,
“#19730E”
],
“datasource”: “Loki”,
“decimals”: null,
“description”: “”,
“esMetric”: “Count”,
“fieldConfig”: {
“defaults”: {
“custom”: {
“align”: null
},
“mappings”: [],
“thresholds”: {
“mode”: “absolute”,
“steps”: [
{
“color”: “green”,
“value”: null
},
{
“color”: “red”,
“value”: 80
}
]
}
},
“overrides”: [
{
“matcher”: {
“id”: “byName”,
“options”: “Requests”
},
“properties”: [
{
“id”: “custom.width”,
“value”: 100
}
]
}
]
},
“gridPos”: {
“h”: 10,
“w”: 15,
“x”: 0,
“y”: 9
},
“hideEmpty”: false,
“hideZero”: false,
“id”: 14,
“initialZoom”: “2”,
“interval”: “30s”,
“locationData”: “countries”,
“mapCenter”: “(0°, 0°)”,
“mapCenterLatitude”: 0,
“mapCenterLongitude”: 0,
“maxDataPoints”: 1,
“mouseWheelZoom”: false,
“pluginVersion”: “7.0.3”,
“showLegend”: true,
“stickyLabels”: true,
“tableQueryOptions”: {
“geohashField”: “geohash”,
“latitudeField”: “latitude”,
“longitudeField”: “longitude”,
“metricField”: “metric”,
“queryType”: “geohash”
},
“targets”: [
{
“expr”: “sum by (geoip_country_code) (count_over_time({filename=”/var/log/nginx/access.log”} | json | error="" [1m]))",
“legendFormat”: “{{geoip_country_code}}”,
“refId”: “A”
}
],
“thresholds”: “5,10”,
“timeFrom”: “15m”,
“timeShift”: null,
“title”: “Countries right now”,
“transformations”: [],
“type”: “grafana-worldmap-panel”,
“unitPlural”: “”,
“unitSingle”: “”,
“valueName”: “total”
},
{
“datasource”: “Loki”,
“fieldConfig”: {
“defaults”: {
“custom”: {}
},
“overrides”: []
},
“gridPos”: {
“h”: 10,
“w”: 9,
“x”: 15,
“y”: 9
},
“id”: 11,
“options”: {
“showLabels”: false,
“showTime”: false,
“sortOrder”: “Descending”,
“wrapLogMessage”: false
},
“targets”: [
{
“expr”: “{filename=”/var/log/nginx/access.log"} | json | line_format “request for {{.httpRequest_requestUrl}} with HTTP status: {{.httpRequest_status}} “\n”,
“legendFormat”: “”,
“refId”: “A”
}
],
“timeFrom”: null,
“timeShift”: null,
“title”: “Logs”,
“type”: “logs”
},
{
“collapsed”: false,
“datasource”: “Loki”,
“gridPos”: {
“h”: 1,
“w”: 24,
“x”: 0,
“y”: 19
},
“id”: 26,
“panels”: [],
“title”: “Request statistics over time”,
“type”: “row”
},
{
“aliasColors”: {
“95th percentile”: “blue”,
“max latency”: “super-light-blue”
},
“bars”: false,
“dashLength”: 10,
“dashes”: false,
“datasource”: “Loki”,
“description”: “”,
“fieldConfig”: {
“defaults”: {
“custom”: {},
“links”: [],
“unit”: “s”
},
“overrides”: []
},
“fill”: 5,
“fillGradient”: 9,
“gridPos”: {
“h”: 9,
“w”: 7,
“x”: 0,
“y”: 20
},
“hiddenSeries”: false,
“id”: 16,
“interval”: “30s”,
“legend”: {
“avg”: false,
“current”: false,
“max”: false,
“min”: false,
“show”: true,
“total”: false,
“values”: false
},
“lines”: true,
“linewidth”: 1,
“nullPointMode”: “null”,
“options”: {
“alertThreshold”: true
},
“percentage”: false,
“pluginVersion”: “7.3.5”,
“pointradius”: 2,
“points”: false,
“renderer”: “flot”,
“seriesOverrides”: [
{
“alias”: “max latency”,
“dashes”: true,
“fillGradient”: 3
}
],
“spaceLength”: 10,
“stack”: false,
“steppedLine”: false,
“targets”: [
{
“expr”: “quantile_over_time(0.95,{filename=”/var/log/nginx/access.log”} | json | unwrap request_time | error="" [KaTeX parse error: Expected group after '_' at position 1: _̲_interval]) by …__interval]))",
“legendFormat”: “max latency”,
“refId”: “D”
}
],
“thresholds”: [
{
“colorMode”: “critical”,
“fill”: true,
“line”: true,
“op”: “gt”,
“value”: 0.3,
“yaxis”: “left”
}
],
“timeFrom”: null,
“timeRegions”: [],
“timeShift”: null,
“title”: “95th percentile of Request Time”,
“tooltip”: {
“shared”: true,
“sort”: 0,
“value_type”: “individual”
},
“type”: “graph”,
“xaxis”: {
“buckets”: null,
“mode”: “time”,
“name”: null,
“show”: true,
“values”: []
},
“yaxes”: [
{
“format”: “s”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
},
{
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: false
}
],
“yaxis”: {
“align”: false,
“alignLevel”: null
}
},
{
“aliasColors”: {
“{statuscode=“200”} 200”: “green”,
“{statuscode=“404”} 404”: “semi-dark-purple”,
“{statuscode=“500”} 500”: “dark-red”
},
“bars”: false,
“dashLength”: 10,
“dashes”: false,
“datasource”: “Loki”,
“description”: “”,
“fieldConfig”: {
“defaults”: {
“custom”: {},
“links”: []
},
“overrides”: []
},
“fill”: 1,
“fillGradient”: 10,
“gridPos”: {
“h”: 9,
“w”: 9,
“x”: 7,
“y”: 20
},
“hiddenSeries”: false,
“id”: 2,
“interval”: “30s”,
“legend”: {
“avg”: false,
“current”: false,
“max”: false,
“min”: false,
“show”: true,
“total”: false,
“values”: false
},
“lines”: true,
“linewidth”: 1,
“nullPointMode”: “connected”,
“options”: {
“alertThreshold”: true
},
“percentage”: true,
“pluginVersion”: “7.3.5”,
“pointradius”: 2,
“points”: false,
“renderer”: “flot”,
“seriesOverrides”: [],
“spaceLength”: 10,
“stack”: true,
“steppedLine”: false,
“targets”: [
{
“expr”: “sum by (httpRequest_status) (count_over_time({filename=”/var/log/nginx/access.log"} | json | error="" [KaTeX parse error: Expected group after '_' at position 1: _̲_interval]))", …__interval]))",
“legendFormat”: “{{host}}”,
“refId”: “A”
}
],
“thresholds”: [],
“timeFrom”: null,
“timeRegions”: [],
“timeShift”: null,
“title”: “Bytes Sent”,
“tooltip”: {
“shared”: true,
“sort”: 0,
“value_type”: “individual”
},
“transformations”: [],
“type”: “graph”,
“xaxis”: {
“buckets”: null,
“mode”: “time”,
“name”: null,
“show”: true,
“values”: []
},
“yaxes”: [
{
“format”: “decbytes”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
},
{
“format”: “short”,
“label”: null,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
}
],
“yaxis”: {
“align”: false,
“alignLevel”: null
}
},
{
“collapsed”: false,
“datasource”: “Loki”,
“gridPos”: {
“h”: 1,
“w”: 24,
“x”: 0,
“y”: 29
},
“id”: 28,
“panels”: [],
“title”: “Acquisition and Behaviour”,
“type”: “row”
},
{
“columns”: [],
“datasource”: “Loki”,
“description”: “”,
“fieldConfig”: {
“defaults”: {
“custom”: {
“align”: null,
“filterable”: false
},
“mappings”: [],
“thresholds”: {
“mode”: “absolute”,
“steps”: [
{
“color”: “green”,
“value”: null
},
{
“color”: “red”,
“value”: 80
}
]
}
},
“overrides”: [
{
“matcher”: {
“id”: “byName”,
“options”: “Requests”
},
“properties”: [
{
“id”: “custom.width”,
“value”: 100
}
]
}
]
},
“fontSize”: “100%”,
“gridPos”: {
“h”: 6,
“w”: 9,
“x”: 0,
“y”: 30
},
“id”: 7,
“interval”: “30s”,
“options”: {
“showHeader”: true,
“sortBy”: [
{
“desc”: true,
“displayName”: “Requests”
}
]
},
“pageSize”: null,
“pluginVersion”: “7.2.2”,
“showHeader”: true,
“sort”: {
“col”: 0,
“desc”: true
},
“styles”: [
{
“alias”: “Time”,
“align”: “auto”,
“dateFormat”: “YYYY-MM-DD HH:mm:ss”,
“pattern”: “Time”,
“type”: “date”
},
{
“alias”: “”,
“align”: “auto”,
“colorMode”: null,
“colors”: [
“rgba(245, 54, 54, 0.9)”,
“rgba(237, 129, 40, 0.89)”,
“rgba(50, 172, 45, 0.97)”
],
“decimals”: 2,
“pattern”: “/./",
“thresholds”: [],
“type”: “number”,
“unit”: “short”
}
],
“targets”: [
{
“expr”: “topk(10, sum by (httpRequest_userAgent) (count_over_time({filename=”/var/log/nginx/access.log"} | json | error="" [KaTeX parse error: Expected group after '_' at position 1: _̲_interval])))",…__interval])))",
“legendFormat”: “{{httpRequest_referer}}”,
“refId”: “A”
}
],
“timeFrom”: null,
“timeShift”: null,
“title”: “Top HTTP Referers”,
“transform”: “table”,
“transformations”: [
{
“id”: “reduce”,
“options”: {
“reducers”: [
“sum”
]
}
},
{
“id”: “organize”,
“options”: {
“excludeByName”: {},
“indexByName”: {},
“renameByName”: {
“Field”: “IP Address”,
“Total”: “Requests”
}
}
}
],
“type”: “table-old”
},
{
“columns”: [],
“datasource”: “Loki”,
“description”: “”,
“fieldConfig”: {
“defaults”: {
“custom”: {
“align”: null,
“filterable”: false
},
“mappings”: [],
“thresholds”: {
“mode”: “absolute”,
“steps”: [
{
“color”: “green”,
“value”: null
},
{
“color”: “red”,
“value”: 80
}
]
}
},
“overrides”: [
{
“matcher”: {
“id”: “byName”,
“options”: “Requests”
},
“properties”: [
{
“id”: “custom.width”,
“value”: 100
}
]
}
]
},
“fontSize”: “100%”,
“gridPos”: {
“h”: 8,
“w”: 9,
“x”: 0,
“y”: 36
},
“id”: 3,
“interval”: “30m”,
“options”: {
“showHeader”: true,
“sortBy”: [
{
“desc”: true,
“displayName”: “Requests”
}
]
},
“pageSize”: null,
“pluginVersion”: “7.2.2”,
“showHeader”: true,
“sort”: {
“col”: 0,
“desc”: true
},
“styles”: [
{
“alias”: “Time”,
“align”: “auto”,
“dateFormat”: “YYYY-MM-DD HH:mm:ss”,
“pattern”: “Time”,
“type”: “date”
},
{
“alias”: “”,
“align”: “auto”,
“colorMode”: null,
“colors”: [
“rgba(245, 54, 54, 0.9)”,
“rgba(237, 129, 40, 0.89)”,
“rgba(50, 172, 45, 0.97)”
],
“decimals”: 2,
“pattern”: "/.
/”,
“thresholds”: [],
“type”: “number”,
“unit”: “short”
}
],
“targets”: [
{
“expr”: “topk(10, sum by (httpRequest_remoteIp) (count_over_time({filename=”/var/log/nginx/access.log"} | json | error="" [KaTeX parse error: Expected group after '_' at position 1: _̲_interval])))",…__interval])))",
“legendFormat”: “{{httpRequest_requestUrl}}”,
“refId”: “A”
}
],
“timeFrom”: null,
“timeShift”: null,
“title”: “Top Requested Pages”,
“transform”: “table”,
“transformations”: [
{
“id”: “reduce”,
“options”: {
“reducers”: [
“sum”
]
}
}
],
“type”: “table-old”
}
],
“refresh”: false,
“schemaVersion”: 26,
“style”: “dark”,
“tags”: [],
“templating”: {
“list”: []
},
“time”: {
“from”: “now-30m”,
“to”: “now”
},
“timepicker”: {
“refresh_intervals”: [
“10s”,
“30s”,
“1m”,
“5m”,
“15m”,
“30m”,
“1h”,
“2h”,
“1d”
]
},
“timezone”: “”,
“title”: “NG”,
“uid”: “Nz6kKgtGk”,
“version”: 30
}
转自

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值