Loki configuration

This commit is contained in:
Colin 2024-04-21 00:38:26 -04:00
parent 2580763559
commit d19a259f52
4 changed files with 40 additions and 1 deletions

View File

@ -1 +1,5 @@
FROM grafana/grafana:latest
FROM grafana/grafana:latest
RUN mkdir -p /etc/grafana/provisioning/datasources /etc/grafana/provisioning/dashboards
COPY custom.ini /etc/grafana/grafana.ini
COPY loki_datasource.yaml /etc/grafana/provisioning/datasources/
COPY dashboard.json /etc/grafana/provisioning/dashboards/

11
docker/grafana/custom.ini Normal file
View File

@ -0,0 +1,11 @@
datasources:
- name: Loki
type: loki
access: proxy # Access mode: 'proxy' (default) or 'direct'
url: http://loki_loki
jsonData:
maxLines: 1000 # Maximum number of lines returned per query
# basicAuth:
# username: myuser
# password: mypassword
default_home_dashboard = Loki

View File

@ -0,0 +1,17 @@
{
"title": "Loki",
"panels": [
{
"title": "Error Rate",
"type": "graph",
"datasource": "Loki",
"targets": [
{
"expr": 'sum(rate({job="my-app", level="error"}[1m])) by (level)',
"legendFormat": "{{level}}",
"refId": "A"
}
]
}
]
}

View File

@ -0,0 +1,7 @@
apiVersion: 1
datasources:
- name: Loki
type: loki
access: proxy
url: http://loki_loki:3100