Giter Site home page Giter Site logo

firecloud-bucket-log-shipper's Introduction

firecloud-bucket-log-shipper

A quick Cloud Function to send bucket audit logs from Google to Logit.


โš ๏ธ **this Cloud Function is not in use. It is not deployed anywhere, nor is the code actively maintained.**


Objective

In order to analyze user metrics on reads and writes of data in Google buckets, we send records of those reads and writes to an Elasticsearch/Logstash/Kibana stack.

High Level Architecture

Audit Logging -> Stackdriver -> Pub/Sub -> Cloud Function -> Logit

We have enabled Cloud Storage Audit Logging for buckets within the FireCloud organization. By default, these logs write to Stackdriver; we then sink the logs from Stackdriver to a Pub/Sub channel.

This Cloud Function triggers on messages to the Pub/Sub channel. Each message contains a single audit log entry; the Cloud Function reads the log entry, extracts relevant details, and ships the details to Logit.

Handling the API Key

This Cloud Function requires a Logit API key in order to send logs to Logit. This API key is read, at runtime, from a secured bucket. When the function is triggered, if its logitApiKey variable is null, it will read the value from the secured bucket and cache its value for later invocations. The Logit API key is secured using bucket ACLs.

Due to the multi-threaded and elastic nature of Cloud Functions, when new code is deployed this can result in many requests to the bucket in a relatively short period of time. It's always worthwhile to monitor new deployments to ensure they are successful.

Deployment

This Cloud Function currently runs only in the FireCloud production environment.

Deployment is currently manual. To deploy updates:

  1. Ensure you have proper permissions.
  2. Check out this repository.
  3. cd into the directory containing the code.
  4. execute gcloud beta functions --account ${YOUR-PROD-ACCOUNT} --project firecloud-log-export deploy metricsLogShipper_v2 --trigger-resource log_aggregate --trigger-event google.pubsub.topic.publish --entry-point metricsLogShipper

Viewing the Cloud Function

You can view the Cloud Function in Google Cloud Console, assuming you have the proper permissions. Naviate to the firecloud-log-export project, then Cloud Functions, and look for the function named metricsLogShipper_v2. From here, you can follow links to read its logs or perform other maintenance and monitoring tasks.

Developer Guidance

Before contributing code to this repository, make sure you have read:

firecloud-bucket-log-shipper's People

Contributors

davidangb avatar

Watchers

James Cloos avatar Joel Thibault avatar Rhian Anthony avatar Henry Ferrara avatar Robert Meffan avatar  avatar michellec avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.