Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bjerkio/google-cloud-logger-slack

Use Google Cloud Logger to push messages to Slack
https://github.com/bjerkio/google-cloud-logger-slack

app cloud-functions cloud-run fastify fastify-plugin gcl google handler logger logging notifications pubsub pulumi slack stackdriver

Last synced: about 1 month ago
JSON representation

Use Google Cloud Logger to push messages to Slack

Awesome Lists containing this project

README

        


Logo


Slack for Google Cloud Logging


Transport messages (and objects) from Google Cloud Logging to Slack




Quick Start Guide
·
Request Feature
·
Report Bug

---

[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)
![Release](https://github.com/bjerkio/gcl-slack/workflows/Release/badge.svg)

[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/bjerkio/gcl-slack.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/bjerkio/gcl-slack/context:javascript)
[![codecov](https://codecov.io/gh/bjerkio/gcl-slack/branch/main/graph/badge.svg)](https://codecov.io/gh/bjerkio/gcl-slack)
[![Maintainability](https://api.codeclimate.com/v1/badges/abaf7c9907eccc452518/maintainability)](https://codeclimate.com/github/bjerkio/gcl-slack/maintainability)

**gcl-slack** consumes logs from Google Cloud Logger and forwards them to Slack.
Use this library to let your team know something happened in your app, an
exception is thrown or use the special [slack object] to turn structured logs to
well-formatted Slack messages.

[slack object]: #
[slack blocks]: https://api.slack.com/block-kit

### :zap:   Features

- Supports Slack webhook and the Slack API ⚙️
- [Slack blocks] 📦
- Sends logs to Slack from all services in your project, including Kubernetes 📬

### :space_invader:   Usage

This project can be deployed using Docker or using Cloud Function (v1).
We recommend using Docker, hosted on Google Cloud Run from GitHub Container Registry.

```
docker pull ghcr.io/bjerkio/google-cloud-logger-slack:v3.1.0
```

You can find examples on how to deploy this project in the [examples] folder, there are both [terraform] and [pulumi] examples

[terraform]: ./examples/terraform
[docker]: ./examples/docker

If you want to use the Cloud Function, you can use the following command to
install it to your project:

```shell
▶ yarn add gcl-slack
```

You can deploy however you want, with Pulumi's [Callback
Function][pulumi-callback] or with [Firebase CLI][firebase], see the [examples].

**We are currently building this library out, and once things are ready for
production loads, we'll add tutorials to make it easier to configure this**

You'll need to configure a [sink] in order to make this work. The basic design
of this library, is that you'll create a [search query] which you add to a [sink] to
forward log entries to `gcl-slack`.

[sink]: https://cloud.google.com/logging/docs/export/configure_export_v2
[search query]: https://cloud.google.com/logging/docs/view/advanced-queries
[examples]: ./examples

### Turn structured logs to well-formatted Slack messages

This package solves two issues, a) forwarding information from Cloud Logger to
Slack and b) offload requests to Slack API / webhooks.

Sometimes we want to be notified on Slack when something happens – let's say a
user is created or a customer subscribed to your service. Since the _stdout_
of our application is hooked into Cloud Logging by default, we can output a
message or a JSON object (structured logging). With a _sink_, we can route
log entites to this library through Google PubSub.

To create more than just a simple message, you can use [slack object]s, which is
the same as you would send to either the Slack API or webhooks to create
well-formatted slack messages.

Let your Kubernetes Pod, Cloud Run or Cloud Functions focus on core business,
and distribute your logging to Slack with this library!

[pulumi-callback]:
https://www.pulumi.com/blog/simple-serverless-programming-with-google-cloud-functions-and-pulumi/
[firebase]: https://firebase.google.com/docs/functions/get-started

## Contribute & Disclaimer

We love to get help 🙏 Read more about how to get started in
[CONTRIBUTING](CONTRIBUTING.md) 🌳