Cloud Functions for Stackdriver Logging to Slack

Runtime: nodejs8

Setup

Export log from Stackdriver Logging to PubSub.

Get Slack incoming Webhook URL.

Logs

You can find the logs in "Global".

Deploy

$ export PUBSUB_TPOIC=<your pubsub topic>
$ export SLACK_WEBHOOK_URL=<your slack incoming webhook url>

$ gcloud beta functions deploy cf-stackdriver-logging-to-slack \
	--runtime=nodejs8 \
	--trigger-topic $PUBSUB_TPOIC \
	--source=. \
	--set-env-vars SLACK_WEBHOOK_URL=$SLACK_WEBHOOK_URL \
	--entry-point=subscribe