You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysqld-mixin/README.md
+37-7Lines changed: 37 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,7 @@ for Grafana:
36
36
$ make build
37
37
```
38
38
39
-
### Loki Logs configuration
40
-
41
-
For proper logs correlation, you need to make sure that `job` and `instance` labels values match for both mysql_exporter metrics and logs, collected by promtail or grafana agent.
39
+
## Loki Logs configuration
42
40
43
41
To enable logs support in MySQLd mixin, enable them in config.libsonnet first:
44
42
@@ -56,7 +54,39 @@ then run
56
54
$ make build
57
55
```
58
56
59
-
This would generate mysql logs dashboard, as well as modified mysql overview dashboard.
60
-
61
-
For more advanced uses of mixins, see
62
-
https://github.com/monitoring-mixins/docs.
57
+
This would generate MySQL logs dashboard, as well as modified MySQL overview dashboard.
58
+
59
+
For proper logs correlation, you need to make sure that `job` and `instance` labels values match for both mysql_exporter metrics and logs, collected by [Promtail](https://grafana.com/docs/loki/latest/clients/promtail/) or [Grafana Agent](https://grafana.com/docs/grafana-cloud/agent/).
60
+
61
+
To scrape MySQL logs the following promtail config snippet can be used for `job=integrations/mysql` and `instance=mysql-01`:
62
+
63
+
```yaml
64
+
scrape_configs:
65
+
- job_name: integrations/mysql
66
+
static_configs:
67
+
- labels:
68
+
instance: mysql-01 # must match instance used in mysqld_exporter
69
+
job: integrations/mysql # must match job used in mysqld_exporter
70
+
__path__: /var/log/mysql/*.log
71
+
pipeline_stages:
72
+
-
73
+
# logs of mysql in sample-apps https://dev.mysql.com/doc/refman/8.0/en/error-log-format.html
74
+
# format time thread [label] [err_code] [subsystem] msg
75
+
# The [err_code] and [subsystem] fields were added in MySQL 8.0
0 commit comments