fluent-plugin-containiq

Fluentd output plugin that pushes logs to ContainIQ.

fluent-plugin-containiq on RubyGems.org

Getting Started

$ gem install fluent-plugin-containiq
<match>
  @type containiq

  <buffer>
    @type file
    path /var/log/fluent/example
  </buffer>
</match>

Publish a new version

Manually bump the spec.version in fluent-plugin-containiq.gemspec. This will trigger a Github action to:

Local Development

Steps to work on the plugin locally:

  • Comment out the fluent-plugin-containiq gem from k8s/Gemfile
  • Build the plugin from source: bundle exec rake build
  • Uncomment the local build in Dockerfile and copy the build path to the CONTAINIQ_PLUGIN_LOCAL_PACKAGE variable
  • Build the image: docker image build . -t containiq/logging-agent-dev
  • In k8s/fluentd-daemonset.yaml, set image: containiq/logging-agent-dev and imagePullPolicy: Never
  • Run the fluentd daemonset: kubectl apply -f k8s/fluentd-daemonset.yaml
  • Run a container in any namespace that spits out logs. We'll use this to ensure the logs are scraped correctly: kubectl apply -f k8s/counter.yaml
  • Verify everything is working in the fluentd logs: kubectl logs -n containiq -f $(kubectl get pod -l name=fluentd -o jsonpath='{.items[0].metadata.name}')

Bundler

Add following line to your Gemfile:

gem "fluent-plugin-containiq"

And then execute:

$ gem update bundler
$ bundle

Run unit tests:

bundle exec rake test

Configuration

You can generate configuration template:

$ fluent-plugin-config-format output containiq