Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leventebalogh/playground-nodejs-loki-grafana
A simple playground for sending logs easily into Loki from Node.js without the need for Promtail.
https://github.com/leventebalogh/playground-nodejs-loki-grafana
Last synced: about 6 hours ago
JSON representation
A simple playground for sending logs easily into Loki from Node.js without the need for Promtail.
- Host: GitHub
- URL: https://github.com/leventebalogh/playground-nodejs-loki-grafana
- Owner: leventebalogh
- Created: 2020-12-16T17:58:25.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T21:40:21.000Z (almost 2 years ago)
- Last Synced: 2024-04-08T17:05:30.782Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 580 KB
- Stars: 17
- Watchers: 2
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js + Loki + Grafana
This is a simple playground for sending random logs from a Node.js service to Loki and then querying
them using Grafana.```
Node.JS (:8080) Loki (:3100) Grafana (:3000)
+-------------------+ +-------------------+ +---------------------+
| | | | | |
| Sends logs | | | | Query with |
| using Winston |-------> <------| LogQL |
| | | | | |
| | | | | |
+-------------------+ +-------------------+ +---------------------+
```![Screenshot](./assets/screenshot.png "Screenshot")
---
## How are the logs sent?
The logs are sent using [winston-loki](https://github.com/JaniAnttonen/winston-loki) which exposes a transform that pushes them directy to the `/loki/api/v1/push` API endpoint of Loki.
---
## Start
```bash
# Starts the following services:
# - Node.js - http://localhost:8080
# - Loki - http://localhost:3100
# - Grafana - http://localhost:3000
$ docker-compose up
```Visit [http://localhost:3000/explore](http://localhost:3000/explore) for playing around with the metrics.
(The service is scraped for random metrics every 1s for more frequent data)---
## Development
```bash
# Starts the Node.js service and restarts it on changes
$ yarn dev# Starts Loki and Grafana
$ docker-compose up loki grafana