Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17. Log monitoring #2956

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Yuliya_Buyalskaya/17.Log_monitoring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## Homework Assignment 1: Use grafana Loki for log monitoring

To use grafana Loki add corresponding [loki.yaml](https://github.com/Julie717/argocd/blob/master/app/monitoring/loki.yaml) to argocd

Check that Loki appeared in argocd

![loki](../17.Log_monitoring/pictures/1.jpg)

Add loki data source in grafana

![loki data source in grafana](../17.Log_monitoring/pictures/2.jpg)

Create grafana dashboard and add variable for intervals

![time interval](../17.Log_monitoring/pictures/3.jpg)

Create graph for counting errors, using logql for writing query
```text
(count_over_time({app="drupal"} |~ "(?i)error" [$time_interval])) or (count_over_time({app="wordpress"} |~ "(?i)error" [$time_interval]))or (count_over_time({app="jenkins"} |~ "(?i)error" [$time_interval]))or (count_over_time({app="node-exporter"} |~ "(?i)error" [$time_interval])) or (count_over_time({app="ingress-nginx"} |~ "(?i)error" [$time_interval]))
```

Mostly errors happened while restarting pods
![errors graph](../17.Log_monitoring/pictures/4.jpg)

On dashboard there is a possibility to change time interval
![time interval changing](../17.Log_monitoring/pictures/5.jpg)
174 changes: 174 additions & 0 deletions Yuliya_Buyalskaya/17.Log_monitoring/grafana_dashboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 1,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "loki",
"uid": "gfa_jUKNz"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"gridPos": {
"h": 11,
"w": 12,
"x": 0,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "loki",
"uid": "gfa_jUKNz"
},
"editorMode": "code",
"expr": "(count_over_time({app=\"drupal\"} |~ \"(?i)error\" [$time_interval])) or (count_over_time({app=\"wordpress\"} |~ \"(?i)error\" [$time_interval]))or (count_over_time({app=\"jenkins\"} |~ \"(?i)error\" [$time_interval]))or (count_over_time({app=\"node-exporter\"} |~ \"(?i)error\" [$time_interval])) or (count_over_time({app=\"ingress-nginx\"} |~ \"(?i)error\" [$time_interval]))",
"queryType": "range",
"refId": "A"
}
],
"title": "Count errors",
"type": "timeseries"
}
],
"refresh": false,
"revision": 1,
"schemaVersion": 38,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": true,
"text": "5m",
"value": "5m"
},
"hide": 0,
"includeAll": false,
"multi": false,
"name": "time_interval",
"options": [
{
"selected": true,
"text": "5m",
"value": "5m"
},
{
"selected": false,
"text": "1h",
"value": "1h"
},
{
"selected": false,
"text": "1d",
"value": "1d"
}
],
"query": "5m, 1h, 1d",
"queryValue": "",
"skipUrlSync": false,
"type": "custom"
}
]
},
"time": {
"from": "2025-02-09T19:10:49.057Z",
"to": "2025-02-10T00:22:52.221Z"
},
"timepicker": {},
"timezone": "",
"title": "New dashboard",
"uid": "I5JBWQFNk",
"version": 5,
"weekStart": ""
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Yuliya_Buyalskaya/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
[Homework 13. Kubernetes. Helm](../Yuliya_Buyalskaya/13.Kubernetes.Helm/README.md) \
[Homework 14. Kubernetes application deployment](../Yuliya_Buyalskaya/14.Kubernetes_application_deployment/README.md) \
[Homework 15. Kubernetes CI CD](../Yuliya_Buyalskaya/15.Kubernetes_CI_CD/README.md) \
[Homework 16. Technical and service monitoring](../Yuliya_Buyalskaya/16.Technical_and_service_monitoring/README.md)
[Homework 16. Technical and service monitoring](../Yuliya_Buyalskaya/16.Technical_and_service_monitoring/README.md) \
[Homework 17. Log monitoring](../Yuliya_Buyalskaya/17.Log_monitoring/README.md)