Skip to content

Commit 7d5488b

Browse files
committed
added loki pod dashboard and fixed datasource provisioning
1 parent b1aa6c0 commit 7d5488b

File tree

3 files changed

+231
-1
lines changed

3 files changed

+231
-1
lines changed
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
{
2+
"annotations": {
3+
"list": [
4+
{
5+
"builtIn": 1,
6+
"datasource": {
7+
"type": "grafana",
8+
"uid": "-- Grafana --"
9+
},
10+
"enable": true,
11+
"hide": true,
12+
"iconColor": "rgba(0, 211, 255, 1)",
13+
"name": "Annotations & Alerts",
14+
"type": "dashboard"
15+
}
16+
]
17+
},
18+
"description": "Search pod logs stored in Loki",
19+
"editable": false,
20+
"fiscalYearStartMonth": 0,
21+
"graphTooltip": 0,
22+
"id": 31,
23+
"links": [],
24+
"panels": [
25+
{
26+
"datasource": "Loki",
27+
"fieldConfig": {
28+
"defaults": {
29+
"color": {
30+
"mode": "palette-classic"
31+
},
32+
"custom": {
33+
"axisBorderShow": false,
34+
"axisCenteredZero": false,
35+
"axisColorMode": "text",
36+
"axisLabel": "",
37+
"axisPlacement": "hidden",
38+
"barAlignment": 0,
39+
"barWidthFactor": 0.6,
40+
"drawStyle": "bars",
41+
"fillOpacity": 100,
42+
"gradientMode": "none",
43+
"hideFrom": {
44+
"legend": false,
45+
"tooltip": false,
46+
"viz": false
47+
},
48+
"insertNulls": false,
49+
"lineInterpolation": "linear",
50+
"lineWidth": 1,
51+
"pointSize": 5,
52+
"scaleDistribution": {
53+
"type": "linear"
54+
},
55+
"showPoints": "never",
56+
"spanNulls": false,
57+
"stacking": {
58+
"group": "A",
59+
"mode": "none"
60+
},
61+
"thresholdsStyle": {
62+
"mode": "off"
63+
}
64+
},
65+
"mappings": [],
66+
"thresholds": {
67+
"mode": "absolute",
68+
"steps": [
69+
{
70+
"color": "green",
71+
"value": null
72+
},
73+
{
74+
"color": "red",
75+
"value": 80
76+
}
77+
]
78+
},
79+
"unit": "short"
80+
},
81+
"overrides": []
82+
},
83+
"gridPos": {
84+
"h": 3,
85+
"w": 24,
86+
"x": 0,
87+
"y": 0
88+
},
89+
"id": 6,
90+
"options": {
91+
"legend": {
92+
"calcs": [],
93+
"displayMode": "list",
94+
"placement": "bottom",
95+
"showLegend": false
96+
},
97+
"tooltip": {
98+
"mode": "multi",
99+
"sort": "none"
100+
}
101+
},
102+
"targets": [
103+
{
104+
"datasource": "Loki",
105+
"expr": "sum(count_over_time({namespace=\"$namespace\", pod=~\"$pod\"} |~ \"$search\"[$__interval]))",
106+
"refId": "A"
107+
}
108+
],
109+
"type": "timeseries"
110+
},
111+
{
112+
"datasource": "Loki",
113+
"gridPos": {
114+
"h": 25,
115+
"w": 24,
116+
"x": 0,
117+
"y": 3
118+
},
119+
"id": 2,
120+
"maxDataPoints": "",
121+
"options": {
122+
"dedupStrategy": "none",
123+
"enableLogDetails": true,
124+
"prettifyLogMessage": false,
125+
"showCommonLabels": false,
126+
"showLabels": false,
127+
"showTime": true,
128+
"sortOrder": "Descending",
129+
"wrapLogMessage": true
130+
},
131+
"targets": [
132+
{
133+
"datasource": "Loki",
134+
"expr": "{namespace=\"$namespace\", pod=~\"$pod\"} |~ \"$search\"",
135+
"refId": "A"
136+
}
137+
],
138+
"title": "Logs Panel",
139+
"type": "logs"
140+
}
141+
],
142+
"schemaVersion": 39,
143+
"tags": [],
144+
"templating": {
145+
"list": [
146+
{
147+
"allValue": ".+",
148+
"current": {
149+
"selected": true,
150+
"text": "ingress-nginx",
151+
"value": "ingress-nginx"
152+
},
153+
"datasource": "Loki",
154+
"definition": "label_values(namespace)",
155+
"hide": 0,
156+
"includeAll": false,
157+
"multi": false,
158+
"name": "namespace",
159+
"options": [],
160+
"query": "label_values(namespace)",
161+
"refresh": 1,
162+
"regex": "",
163+
"skipUrlSync": false,
164+
"sort": 0,
165+
"tagValuesQuery": "",
166+
"tagsQuery": "",
167+
"type": "query",
168+
"useTags": false
169+
},
170+
{
171+
"allValue": ".+",
172+
"current": {
173+
"selected": false,
174+
"text": "All",
175+
"value": "$__all"
176+
},
177+
"datasource": "Loki",
178+
"definition": "label_values({namespace=~\"$namespace\"}, pod)",
179+
"hide": 0,
180+
"includeAll": true,
181+
"multi": true,
182+
"name": "pod",
183+
"options": [],
184+
"query": "label_values({namespace=~\"$namespace\"}, pod)",
185+
"refresh": 1,
186+
"regex": "",
187+
"skipUrlSync": false,
188+
"sort": 0,
189+
"tagValuesQuery": "",
190+
"tagsQuery": "",
191+
"type": "query",
192+
"useTags": false
193+
},
194+
{
195+
"current": {},
196+
"hide": 0,
197+
"name": "search",
198+
"options": [],
199+
"query": "",
200+
"skipUrlSync": false,
201+
"type": "textbox"
202+
}
203+
]
204+
},
205+
"time": {
206+
"from": "now-6h",
207+
"to": "now"
208+
},
209+
"timepicker": {
210+
"refresh_intervals": [
211+
"5s",
212+
"10s",
213+
"30s",
214+
"1m",
215+
"5m",
216+
"15m",
217+
"30m",
218+
"1h",
219+
"2h",
220+
"1d"
221+
]
222+
},
223+
"timezone": "",
224+
"title": "Loki / Pod Logs",
225+
"uid": "209fd89b771c318dd442225414a50b59",
226+
"version": 1,
227+
"weekStart": ""
228+
}

ansible/roles/kube_prometheus_stack/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
tag: 2.9.3
192192
grafana:
193193
sidecar:
194-
grafana_datasources:
194+
datasources:
195195
enabled: false
196196
wait: yes
197197

environments/common/inventory/group_vars/all/grafana.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ grafana_dashboards_default:
3838
- placeholder: DS_PROMETHEUS
3939
replacement: prometheus
4040
revision_id: 3
41+
- dashboard_file: loki-pod-logs-dashboard.json
42+
replacements: []
4143
grafana_dashboards: "{{ grafana_dashboards_default + (openondemand_dashboard if groups.get('openondemand') else []) }}"
4244

4345
# Configmap names of kube prometheus stack's default dashboards to exclude

0 commit comments

Comments
 (0)