Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/screenshotone/cflokiworker
Cloudflare Tail Worker for pushing logs to Grafana Loki
https://github.com/screenshotone/cflokiworker
cloudflare cloudflare-worker cloudflare-workers grafana grafana-loki logger logging
Last synced: 26 days ago
JSON representation
Cloudflare Tail Worker for pushing logs to Grafana Loki
- Host: GitHub
- URL: https://github.com/screenshotone/cflokiworker
- Owner: screenshotone
- License: mit
- Created: 2024-01-12T16:55:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-13T12:52:09.000Z (about 1 year ago)
- Last Synced: 2024-11-14T01:33:42.120Z (3 months ago)
- Topics: cloudflare, cloudflare-worker, cloudflare-workers, grafana, grafana-loki, logger, logging
- Language: TypeScript
- Homepage:
- Size: 20.5 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cflokiworker
`cflokiworker` is a [Cloudflare Tail Worker](https://developers.cloudflare.com/workers/observability/tail-workers/) for pushing logs and unhandled exceptions to [Grafana Loki](https://grafana.com/oss/loki/) from your Cloudflare workers.
The worker is being used on production for collecting logs from [the ScreenshotOne API](https://screenshotone.com/) Gateway which is implemented as a Cloudflare worker.
## Getting Started
### Clone or Fork, and Deploy
You can clone the repository and use it directly for your needs without any modifications.
```shell
git clone [email protected]:screenshotone/cflokiworker.git
npm install
npm run deploy
```Or you can fork it, modify, and deploy your version of the worker. If you feel it can be shared with everybody, don't hesitate to contribute back by creating a pull request.
### Attach to Workers
Once deployed to Cloudflare, you need to update your `wrangler.toml` for workers you want to stream logs from:
```toml
tail_consumers = [{ service = "logger" }]
```## GitHub Actions
When using with GitHub Actions, you need to have 2 secrets available:
- `LOKI_PUSH_URL`` is an HTTP URL of the Loki instance.
- `LOKI_CREDENTIALS` is a base64-encoded username:password for accessing the Loki instance.## Resources
You can learn more about Cloudflare Tail Workers at:
1. [Cloudflare Tail Workers official documentation](https://developers.cloudflare.com/workers/observability/tail-workers/).
2. [A guide on pushing logs to Grafana Loki from Cloudflare Workers with Tail Workers](https://scalabledeveloper.com/posts/cloudflare-tail-worker-for-pushing-logs-to-grafana-loki/).## License
`cflokiworker` is released under [the MIT license](LICENSE).