Skip to content

bjerkio/google-cloud-logger-slack

Repository files navigation

Logo

Slack for Google Cloud Logging

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

Quick Start Guide · Request Feature · Report Bug


lifecycle code style: prettier Commitizen friendly Release

Language grade: JavaScript codecov 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.

⚡   Features

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

👾   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

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

▶ yarn add gcl-slack

You can deploy however you want, with Pulumi's Callback Function or with Firebase CLI, 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.

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 objects, 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!

Contribute & Disclaimer

We love to get help 🙏 Read more about how to get started in CONTRIBUTING 🌳