Giter Club home page Giter Club logo

fluent-plugin-dogstatsd's Introduction

fluent-plugin-dogstatsd

Fluend plugin for Dogstatsd, that is statsd server for Datadog.

Installation

$ gem install fluent-plugin-dogstatsd

Usage

$ echo '{"type": "increment", "key": "apache.requests", "tags": {"url": "/"}}' | fluent-cat dogstatsd.hello
$ echo '{"type": "histogram", "key": "apache.response_time", "value": 10.5, "tags": {"url": "/hello"}}' | fluent-cat dogstatsd.hello
$ echo '{"type": "event", "title": "Deploy", "text": "New revision"}' | fluent-cat dogstatsd.hello

Supported types are increment, decrement, count, gauge, histogram, timing, set and event.

Configuration

<match dogstatsd.*>
  type dogstatsd

  # Dogstatsd host
  host localhost

  # Dogstatsd port
  port 8125

  # Use tag of fluentd record as key sent to Dogstatsd
  use_tag_as_key false

  # (Treat fields in a record as tags)
  # flat_tags true

  # (Metric type in Datadog.)
  # metric_type increment

  # Default: "value"
  # value_key Value
</match>

Example

Count log lines

<source>
  type tail
  path /tmp/sample.log
  tag datadog.increment.sample
  format ...
</source>

<match datadog.increment.*>
  type dogstatsd
  metric_type increment
  flat_tags true
  use_tag_as_key true
</match>

Histogram

<source>
  type tail
  path /tmp/sample.log
  tag datadog.histogram.sample
  format /^(?<value>[^ ]*) (?<host>[^ ]*)$/
</source>

<match datadog.histogram.*>
  type dogstatsd
  metric_type histogram
  flat_tags true
  use_tag_as_key true
</match>

Event

<source>
  type tail
  path /var/log/nginx/error.log
  pos_file /var/log/td-agent/error.log.pos
  format multiline
  format_firstline /^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} \[\w+\] (?<pid>\d+).(?<tid>\d+): /
  format1 /^(?<time>\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}) \[(?<alert_type>\w+)\] (?<pid>\d+).(?<tid>\d+): (?<message>.*)/
  multiline_flush_interval 3s
  tag datadog.nginx.errorlog
</source>

<match datadog.nginx.errorlog>
  type dogstatsd
  metric_type event
  use_tag_as_key true
  text_key message
</match>

MySQL threads

<source>
  type mysql_query
  tag datadog.histogram.mysql_threads
  query SHOW VARIABLES LIKE 'Thread_%'
</source>

<match datadog.histogram.mysql_threads>
  type dogstatsd
  metric_type histogram
  value_key Value
  flat_tags true
  use_tag_as_key true
</match>

Contributing

  1. Fork it ( https://github.com/ryotarai/fluent-plugin-dogstatsd/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

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.