1

Is there any way to configure promtail to send logs to loki via https-ingress?

promtail ---> https-ingress ---> loki

I used this helm chart promtail and configured loki url as http://gateway.loki.monitoring.example.com:80/loki/api/v1/push. After I deploy promtail chart I see below errors in promtail pod

level=error ts=2022-03-28T14:10:23.740581978Z caller=client.go:360 component=client host=gateway.loki.monitoring.example.com:80 msg="f
inal error sending batch" status=308 error="server returned HTTP status 308 Permanent Redirect (308): <html>"

I even specified https in loki url as https://gateway.loki.monitoring.example.com:80/loki/api/v1/push but still failing

level=warn ts=2022-03-28T14:27:47.976570998Z caller=client.go:349 component=client host=gateway.loki.monitoring.example:80 msg="er
ror sending batch, will retry" status=-1 error="Post \"https://gateway.loki.monitoring.example.com:80/loki/api/v1/push\": http: server
 gave HTTP response to HTTPS client"

I found this config https://grafana.com/docs/loki/latest/installation/helm/#run-loki-behind-https-ingress, but it is outdated

NOTE:

  • I have not configured any https at loki side.
  • Configured loki-distributed chart's ingress like below(and rest ingress config are default)
...
  ingress:
    # -- Specifies whether an ingress for the gateway should be created
    enabled: true
    # -- Ingress Class Name. MAY be required for Kubernetes versions >= 1.18
    ingressClassName: monitoring-ingress
    # -- Annotations for the gateway ingress
    annotations:
      cert-manager.io/cluster-issuer: monitoring-cluster-issuer
    # -- Hosts configuration for the gateway ingress
    hosts:
      - host: gateway.loki.monitoring.example.com
        paths:
          - path: /
            # -- pathType (e.g. ImplementationSpecific, Prefix, .. etc.) might also be required by some Ingress Controllers
            pathType: Prefix
    # -- TLS configuration for the gateway ingress
    tls:
      - secretName: loki-gateway-tls-certs
        hosts:
          - gateway.loki.monitoring.example.com
...

Did I miss any ingress config at loki?

Veerendra K
  • 2,145
  • 7
  • 32
  • 61

1 Answers1

2

After I played some time, I understood I need to remove port and specify https for the loki URL. Should be like below

https://gateway.loki.monitoring.example.com/loki/api/v1/push
Veerendra K
  • 2,145
  • 7
  • 32
  • 61