A Loki powered log provider for OpenFaaS
OpenFaaS Loki implementes the new log provider interface from faas-provider
. This means you can query Loki for your function logs with the faas-cli
!
Limitations: This initial version does not support log tail streams. This means that faas-cli logs
will alway behave as if --follow=false
. Live tailing of the logs is currently being worked on.
All other OpenFaaS log behaviors should be fully supported. Issues are welcome if you notice a bug or room for improvement.
- Clone this repo
- Determine the URL of your Loki installation, if you used the default Helm values to install Loki, this will be
http://<service name>.<namespace>:3100
- Then install the
openfaas-loki
provider using Helm:helm upgrade --install ofloki oci:://ghcr.io/lucasroesler/charts/openfaas-loki \ --namespace openfaas \ --set lokiURL=http://loki.monitoring:3100 \ --set logLevel=DEBUG
- Then update the
gateway
with the environment variable described in the NOTES output of the helm install. Currently, this can be done usingThe environment variable is only needed on thekubectl -n openfaas set env deployment/gateway -c gateway -e logs_provider_url=http://ofloki-openfaas-loki.openfaas:9191/
gateway
container. - Test the installation using
faas-cli store deploy nodeinfo echo "" | faas-cli invoke nodeinfo faas-cli logs nodeinfo --tail=3
OpenFaaS Loki is built with go 1.12+ and uses go modules and all of the development actions are currently defined through the Makefile
make test
You can install using
make install
Check the installation using
openfaas-loki --version
Build the Docker image for amd64 archs and verify the build using
make image ARCH=linux/amd64 OWNER=lucasroesler REGISTRY=ghcr.io
docker run ghcr.io/lucasroesler/openfaas-loki:dev --version