Giter VIP home page Giter VIP logo

fly-log-local's Introduction

fly-log-local

Local logging at Fly using Vector and Loki.

This app reads the Fly NATS endpoint using Vector which then sends to Loki for the datastore on the attached volume. The logs can later be accessed via Logcli or any other Loki client. In this example the Loki endpoint is running without authentication and only accessible via fly proxy.

Quickstart

Create Fly app

fly apps create <insert-app-name>

Edit fly.toml

Update the app name.

app = "<insert-app-name>"

Create volume

fly volumes create log_data

Create secret

fly secrets set ACCESS_TOKEN=$(fly auth token)

Scale memory ( optional )

fly scale memory 512

Deploy

fly deploy

Install logcli

brew install logcli

Start proxy

fly proxy 3100:3100

Search loki

Tailing all app logs.

~/ logcli query -z UTC -q '{forwarder="vector"}' -t
2022-08-18T14:33:35Z {fly_app="fly-log-local-example", fly_instance="c1046e0d", forwarder="vector"} 2022-08-18 14:33:35,571 INFO success: loki entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-08-18T14:33:35Z {fly_app="fly-log-local-example", fly_instance="c1046e0d", forwarder="vector"} 2022-08-18 14:33:35,572 INFO success: vector entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-08-18T14:40:51Z {fly_app="bold-star-5487", fly_instance="97200383", forwarder="vector"} Starting instance
2022-08-18T14:40:58Z {fly_app="bold-star-5487", fly_instance="97200383", forwarder="vector"} Configuring virtual machine
2022-08-18T14:40:58Z {fly_app="bold-star-5487", fly_instance="97200383", forwarder="vector"} Pulling container image
2022-08-18T14:40:58Z {fly_app="bold-star-5487", fly_instance="97200383", forwarder="vector"} Unpacking image
2022-08-18T14:40:58Z {fly_app="bold-star-5487", fly_instance="97200383", forwarder="vector"} Preparing kernel init
2022-08-18T14:40:59Z {fly_app="bold-star-5487", fly_instance="97200383", forwarder="vector"} Configuring firecracker
2022-08-18T14:40:59Z {fly_app="bold-star-5487", fly_instance="97200383", forwarder="vector"} Starting virtual machine
2022-08-18T14:40:59Z {fly_app="bold-star-5487", fly_instance="97200383", forwarder="vector"} Starting init (commit: 9b0a951)...
...

Specific app and from time.

~/ logcli query -z UTC -q --from="2022-08-18T14:30:00Z" '{fly_app="fly-log-local-example"}'
2022-08-18T14:33:35Z {} 2022-08-18 14:33:35,572 INFO success: vector entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-08-18T14:33:35Z {} 2022-08-18 14:33:35,571 INFO success: loki entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Additional documentation can be found here: https://grafana.com/docs/loki/latest/tools/logcli/

fly-log-local's People

Contributors

draper7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fly-log-local's Issues

Deploy error: failed to fetch an image or build from source

I get the following error when deploying the app with fly deploy:

Error: failed to fetch an image or build from source: error building: executor failed running [/bin/sh -c git clone https://github.com/grafana/loki.git     && cd loki     && make loki logcli]: exit code: 2

While building, the process stops with the following:

imports github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container: build constraints exclude all Go files in /go/loki/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container
#10 17.25 vendor/github.com/grafana/dskit/netutil/netutil.go:6:2: cannot find package "." in:
#10 17.25 	/go/loki/vendor/net/netip
#10 17.26 make: *** [Makefile:158: cmd/loki/loki] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.