My question background:
- grafana version = 9.5.3
- loki = 2.9.6, helm charts = loki-distributed-0.78.5
I want to integrate multiple data sources into the same Grafana for display.
The local loki cluster has been successfully connected and logs can be obtained. The address is:
http://loki-distributed-query-frontend.loki:3100
When connecting to a remote Loki, due to network limitations, I can only use ingress nginx as a proxy,My configuration for remote ingress nginx is as follows:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$2
name: http-loki-myapiserver
namespace: myapiserver
spec:
rules:
- host: myapiserver.loki-local.com
http:
paths:
- backend:
service:
name: loki-apiserver
port:
number: 3100
path: /loki(/|$)(.*)
pathType: Prefix
Grafana configuring remote data sources:
http://myapiserver.loki-local.com/loki
Error reported in save&test:
Unable to fetch labels from Loki (Not Found), please check the server logs for more details
Grafana logs:
logger=context userId=1 orgId=1 uname=admin t=2024-05-23T03:45:37.315914664Z level=info msg="Request Completed" method=GET path=/api/datasources/uid/e13e1e70-6fd3-493c-959f-4fb91380949e/resources/labels status=404 remote_addr=2xx.xx.xx.x8 time_ms=111 duration=111.128925ms size=23 referer=http://1x.xx.xx.x5:31658/connections/your-connections/datasources/edit/e13e1e70-6fd3-493c-959f-4fb91380949e handler=/api/datasources/uid/:uid/resources/*
Remote ingress nginx logs:
- - [23/May/2024:06:16:59 +0000] "GET /loki/loki/api/v1/labels?start=1716444418990000000&end=1716445018990000000 HTTP/1.1" 404 9 "-" "Grafana/9.5.3" 708 0.000 [-] [] - - - - d2fd120e1a7022d2b6c74e0984d167ca
I have already done a rewrite operation in my ingress, why hasn’t it taken effect?
i hope to receive help, thank you.