Skip to content

Commit

Permalink
Add LICENSE and simple README
Browse files Browse the repository at this point in the history
  • Loading branch information
krasun committed Jan 13, 2024
1 parent 0af278e commit 754b80e
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Dmytro Krasun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 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).

0 comments on commit 754b80e

Please sign in to comment.