https://github.com/rpcpool/fluent-plugin-triton
https://github.com/rpcpool/fluent-plugin-triton
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rpcpool/fluent-plugin-triton
- Owner: rpcpool
- Created: 2024-12-05T16:20:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-21T17:59:10.000Z (11 months ago)
- Last Synced: 2025-04-21T18:45:31.811Z (11 months ago)
- Language: Ruby
- Size: 8.79 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fluent::Plugin::Triton
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/fluent/plugin/triton`. To experiment with that code, run `bin/console` for an interactive prompt.
This gem contains Custom Fluentd plugins used at Triton One.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'fluent-plugin-triton'
```
And then execute:
$ bundle install
Or install it yourself as:
$ gem install fluent-plugin-triton
## Usage
### Nomad filter plugin
This filter plugin allow you to add tags nomad related records from logs emitted by nomad client.
Here is an example how to write a `fluent.conf` file to add useful nomad tag:
```xml
@type tail
path '/var/lib/nomad/alloc/**/**/alloc/logs/*.stdout.*'
pos_file /var/log/td-agent/tmp/access.log.pos
@type json
path_key tailed_path
tag nomad.log
@type record_transformer
enable_ruby
alloc_id ${record['tailed_path'].split('alloc/')[1].split('/')[0]}
@type nomad
alloc_id_field alloc_id
nomad_addr
nomad_token
```
The first `nomad.log` source tail all allocation folder generated by nomad-client.
For each record we add the provenance "tailed_path" to it so we can extract it's allocation id.
The first `nomad.log` filter extract the `alloc_id` used to query allocation information such as job, node, task group, namespace, etc.
The second `nomad.log` filter descripe what field contains the `alloc_id` using `alloc_id_field` and you can provide
`nomad_addr` and `nomad_token` as connection information.
The last two parameters are optional if `fluentd`'s environment variable contains `NOMAD_TOKEN` and `NOMAD_ADDR`.
## Development
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/fluent-plugin-triton.