Giter Site home page Giter Site logo

tilfin / fluent-plugin-bunyan-to-google-cloud-logging Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 13 KB

Fluentd plugin to parse bunyan format logs and to transfer Google Cloud Logging.

License: Apache License 2.0

Ruby 100.00%
fluentd-plugin google-cloud-logging stackdriver-logs bunyan

fluent-plugin-bunyan-to-google-cloud-logging's Introduction

fluent-plugin-bunyan-to-google-cloud-logging

Gem Version

Fluentd plugin to parse bunyan format logs and to transfer Google Cloud Logging.

Installation

RubyGems

$ gem install fluent-plugin-bunyan-to-google-cloud-logging

Bundler

Add following line to your Gemfile:

gem "fluent-plugin-bunyan-to-google-cloud-logging"

And then execute:

$ bundle

Configuration

Example 1. Tailing a log file and transfering to Google Cloud Logging

<source>
  @type tail
  path /tmp/myapp.log
  pos_file /tmp/myapp.log.pos
  tag myapp.trace
  <parse>
    @type json
    time_key time
    time_format %FT%T.%L%z
  </parse>
</source>

<match **>
  @type bunyan_to_google_cloud_logging
  project_id  'my-project-211117'
  keyfile /etc/td-agent/secret/keyfile.json
</match>

Example 2. Receiving docker container logs and transfering to Google Cloud Logging

/etc/td-agent/td-agent.conf

<source>
  @type forward
</source>

<filter docker.**>
  @type parser
  format json
  key_name log
  time_key time
  time_format %FT%T.%L%z
  reserve_data yes
</filter>

<filter docker.**>
  @type record_transformer
  remove_keys log
  <record>
    time ${time}
    app_tag ${tag_parts[1]}
  </record>
</filter>

<match docker.**>
  @type bunyan_to_google_cloud_logging
  project_id  'high-office-001'
  keyfile /etc/td-agent/secret/gcp-key.json
</match>

<label @ERROR>
  <match **>
    @type bunyan_to_google_cloud_logging
    project_id  'high-office-001'
    keyfile /etc/td-agent/secret/gcp-key.json
  </match>
</label>

docker-compose.yml

version: '3'
services:
  yourwebapp:
    image: registry.example.com/yourwebapp
    logging:
      driver: fluentd
      options:
        fluentd-address: "localhost:24224"
        tag: "docker.webapp"
    environment:
      NODE_ENV: production
    ports:
      - 8080:8080

Fluent::Plugin::BunyanToGoogleCloudLoggingOutput

project_id (string) (required)

your Project ID on Google Cloud Platform

keyfile (string) (required)

Specify the path of key json file https://cloud.google.com/iam/docs/creating-managing-service-account-keys

Copyright

  • Copyright(c) 2018- Toshimitsu Takahashi
  • License
    • Apache License, Version 2.0

fluent-plugin-bunyan-to-google-cloud-logging's People

Contributors

tilfin avatar

Watchers

 avatar  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.