loki: ability to serve off non root path

Created on 17 Dec 2018  路  18Comments  路  Source: grafana/loki

It's somewhat common to deploy services like loki off the web root (i.e. infra.corp.io/loki) when used with auth proxies. I'm currently unable to find a configuration for doing so.

Prometheus offers the following config:

--web.external-url=https://infra.corp.io/prometheus/

Looking at the webworks server config I don't see support already baked in for that either. Do you know if that's true? Would this be accepted into loki? I'll try and submit a patch.

componenloki kinfeature

Most helpful comment

Sorted out

 http:
  - match:
    - uri:
        prefix: /loki
    rewrite:
      uri: /loki
    route:
    - destination:
        host: loki.test.svc.cluster.local
        port:
          number: 3100
  - match:
    - uri:
        prefix: /metrics
    rewrite:
      uri: /loki/metrics
    route:
    - destination:
        host: loki.test.svc.cluster.local
        port:
          number: 3100

All 18 comments

This is something we鈥檇 be keen on, yes! I guess it probably belongs in weaveworks/common/server.

Yep. That issue looks to be the same goal as this one.

It looks like the package for this is running off @tomwilkie's fork, is there work needed to merge those together?

[[constraint]]
  name = "github.com/weaveworks/common"
  source = "github.com/tomwilkie/weaveworks-common"
  branch = "dev"

@adamdecaf sorry about that - need https://github.com/weaveworks/common/pull/146 merging before we can go back to master. Shouldn't be long now!

146 is merged now - @gouthamve or @adamdecaf, want to update the vendoring?

Does the version v0.2.0 provides any command line flag like --web.external-url from prometheus already? Or is it comming out with version v0.3.0?

There's -server.path-prefix=/loki/

helm upgrade --install loki loki/loki-stack --namespace=monitoring -server.path-prefix=/loki/
Error: unknown shorthand flag: 's' in -server.path-prefix=/loki/

helm upgrade --install loki loki/loki-stack --namespace=monitoring -server.path-prefix=/loki/
Error: unknown shorthand flag: 's' in -server.path-prefix=/loki/

shouldn't it be something like?:

helm upgrade --install loki loki/loki-stack --namespace=monitoring --set server.path-prefix=/loki/

It should be --set loki.extraArgs.server.path-prefix=/loki/ but it doesn't work with object in helm. see https://github.com/grafana/loki/issues/1668#issuecomment-584406225

Final podspec contains this args:

- "-server=map[path-prefix:/loki/]" which is weird.

What is the working solution for path-prefix? @cyriltovena @ArthurSens

--set loki.extraArgs.server.path-prefix=/loki/ ?

We use -server.path-prefix=/loki/ for our Loki setups on version 1.5.0.

See: https://github.com/moov-io/infra/blob/6e3fac6749bea9b70b1fe68e3a717923d0506484/lib/infra/19-loki.yml#L113

Solution works for me

extraArgs:
  server.path-prefix: /loki/

livenessProbe:
  httpGet:
    path: /loki/ready
    port: http-metrics
  initialDelaySeconds: 45

readinessProbe:
  httpGet:
    path: /loki/ready
    port: http-metrics
  initialDelaySeconds: 45

@adamdecaf Yep, exactly, I wonder how CLI option could help as config is dependent on probes. How do you access /metrics endpoint? I still see inconsistency between different loki endpoints

Sorted out

 http:
  - match:
    - uri:
        prefix: /loki
    rewrite:
      uri: /loki
    route:
    - destination:
        host: loki.test.svc.cluster.local
        port:
          number: 3100
  - match:
    - uri:
        prefix: /metrics
    rewrite:
      uri: /loki/metrics
    route:
    - destination:
        host: loki.test.svc.cluster.local
        port:
          number: 3100

values file is the way to go ! --set is unhappy :/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mario-Hofstaetter picture Mario-Hofstaetter  路  4Comments

cyriltovena picture cyriltovena  路  4Comments

negbie picture negbie  路  3Comments

gouthamve picture gouthamve  路  4Comments

arnitolog picture arnitolog  路  6Comments