kube-prometheus icon indicating copy to clipboard operation
kube-prometheus copied to clipboard

Add support for logs (loki/fluentbit)

Open atmosx opened this issue 5 years ago • 11 comments

What is missing?

Loki and fluentbit integration.

NOTE: From a quick look at promtail's release notes looks it is bug-ridden which makes sense as it's a young project. Fluentbit on the other hand is a battle-tested alternative.

Why do we need it?

To add logging server to grafana. This way can have a full featured stack instead of just metrics.

Jaeger would also be a nice addition in the future, since Grafana now has integrated support for traces.

Environment

any

Anything else we need to know?:

I would like to know if you would be interested in the idea of adding Loki as part of the stack.

atmosx avatar May 27 '20 17:05 atmosx

kube-prometheus project is about delivering monitoring stack based on prometheus. Logging as such is out of scope for the project.

paulfantom avatar May 29 '20 11:05 paulfantom

While I agree with @paulfantom I think there have been various folks who have created integrations with loki. I do think it belongs in a separate project but I agree it would awesome to have well integrated stacks. This one is a little outdated but I know there are some folks working on stuff in this direction :)

brancz avatar May 29 '20 12:05 brancz

The integration is pretty trivial actually. You just setup your loki stack and add loki as a datasource to your kube-prometheus Grafana instance:

  {                                                                                                                                                                                                                                           
    _config+:: {
      grafana+:: {                                                                                                                                                                                                                            
        datasources+: [{                                                                                                                                                                                                                      
          name: 'loki',                                                                                                                                                                                                                       
          type: 'loki',                                                                                                                                                                                                                       
          access: 'proxy',                                                                                                                                                                                                                    
          org_id: 1,                                                                                                                                                                                                                          
          url: 'http://loki.loki:3100',                                                                                                                                                                                                       
          version: 1,                                                                                                                                                                                                                         
          editable: false,                                                                                                                                                                                                                    
        }],                                                                                                                                                                                                                                   
      },                                                                                                                                                                                                                                      
    },
  }

brancz avatar May 29 '20 12:05 brancz

For those looking for a quick recipe, I tried it just now using the suggested datasource configuration in the comment above. I had to change the url address to http://loki:3100 (instead of loki.loki). The following helm commands add the loki stack:

helm repo add loki https://grafana.github.io/loki/charts
helm repo update
helm upgrade --install loki loki/loki-stack --namespace monitoring

jobh avatar Jun 22 '20 09:06 jobh

I think we would like to have this as an example jsonnet file in examples/ directory. Possibly with some documentation. Any takers for doing this? :)

paulfantom avatar Mar 02 '21 20:03 paulfantom

It would be great to have loki and promtail alert presets as addons.

xpepermint avatar Apr 15 '21 16:04 xpepermint

At this point it is unclear how integrating loki would our ability to distribute kube-prometheus as apache 2 license. For the time being it will need to be an extension hosted outside of this repository. That shouldn't discourage people from doing so outside of this repo though and link to it! :)

brancz avatar Apr 22 '21 12:04 brancz

It would be great to have Loki, Tempo and promtail alert presets as addons.

Kiddinglife avatar Dec 11 '21 10:12 Kiddinglife

The integration is pretty trivial actually. You just setup your loki stack and add loki as a datasource to your kube-prometheus Grafana instance:

  {                                                                                                                                                                                                                                           
    _config+:: {
      grafana+:: {                                                                                                                                                                                                                            
        datasources+: [{                                                                                                                                                                                                                      
          name: 'loki',                                                                                                                                                                                                                       
          type: 'loki',                                                                                                                                                                                                                       
          access: 'proxy',                                                                                                                                                                                                                    
          org_id: 1,                                                                                                                                                                                                                          
          url: 'http://loki.loki:3100',                                                                                                                                                                                                       
          version: 1,                                                                                                                                                                                                                         
          editable: false,                                                                                                                                                                                                                    
        }],                                                                                                                                                                                                                                   
      },                                                                                                                                                                                                                                      
    },
  }

Actually, Grafana seems to autodiscover Loki-stack as datasource. At least when it is deployed in the same namespace.

Jasper-Ben avatar Feb 09 '22 14:02 Jasper-Ben

For anyone wondering how do you get that URL when it's just a service running in kubernetes:

http://<service_name>.<service_namespace>:3100

gsusI avatar Aug 26 '22 13:08 gsusI

For those looking for a quick recipe, I tried it just now using the suggested datasource configuration in the comment above. I had to change the url address to http://loki:3100 (instead of loki.loki). The following helm commands add the loki stack:

helm repo add loki https://grafana.github.io/loki/charts
helm repo update
helm upgrade --install loki loki/loki-stack --namespace monitoring

Loki's helm chart path has been changed to the below,

helm repo add grafana https://grafana.github.io/helm-charts
helm repo update 
helm upgrade --install loki  grafana/loki-stack --namespace monitoring 

Ref: https://github.com/grafana/helm-charts/tree/main/charts/loki-stack

govindkailas avatar Nov 02 '23 00:11 govindkailas