https://github.com/tilfin/fluent-plugin-bunyan-to-google-cloud-logging
Fluentd plugin to parse bunyan format logs and to transfer Google Cloud Logging.
https://github.com/tilfin/fluent-plugin-bunyan-to-google-cloud-logging
bunyan fluentd-plugin google-cloud-logging stackdriver-logs
Last synced: 4 months ago
JSON representation
Fluentd plugin to parse bunyan format logs and to transfer Google Cloud Logging.
- Host: GitHub
- URL: https://github.com/tilfin/fluent-plugin-bunyan-to-google-cloud-logging
- Owner: tilfin
- License: apache-2.0
- Created: 2018-07-28T04:47:10.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-29T15:11:59.000Z (over 6 years ago)
- Last Synced: 2025-03-11T11:53:19.419Z (4 months ago)
- Topics: bunyan, fluentd-plugin, google-cloud-logging, stackdriver-logs
- Language: Ruby
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fluent-plugin-bunyan-to-google-cloud-logging
[](https://badge.fury.io/rb/fluent-plugin-bunyan-to-google-cloud-logging)
[Fluentd](https://www.fluentd.org/) plugin to parse [bunyan](https://www.npmjs.com/package/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:
```ruby
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
```
@type tail
path /tmp/myapp.log
pos_file /tmp/myapp.log.pos
tag myapp.trace
@type json
time_key time
time_format %FT%T.%L%z
@type bunyan_to_google_cloud_logging
project_id 'my-project-211117'
keyfile /etc/td-agent/secret/keyfile.json```
### Example 2. Receiving docker container logs and transfering to Google Cloud Logging
#### /etc/td-agent/td-agent.conf
```
@type forward
@type parser
format json
key_name log
time_key time
time_format %FT%T.%L%z
reserve_data yes@type record_transformer
remove_keys log
time ${time}
app_tag ${tag_parts[1]}
@type bunyan_to_google_cloud_logging
project_id 'high-office-001'
keyfile /etc/td-agent/secret/gcp-key.json
@type bunyan_to_google_cloud_logging
project_id 'high-office-001'
keyfile /etc/td-agent/secret/gcp-key.json
```
#### 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