graphite

edit
  • Version: 3.1.1
  • Released on: 2016-07-14
  • Changelog
  • Compatible: 5.1.1.1, 5.0.0, 2.4.1, 2.4.0, 2.3.4

This output allows you to pull metrics from your logs and ship them to Graphite. Graphite is an open source tool for storing and graphing metrics.

An example use case: Some applications emit aggregated stats in the logs every 10 seconds. Using the grok filter and this output, it is possible to capture the metric values from the logs and emit them to Graphite.

 

Synopsis

edit

This plugin supports the following configuration options:

Required configuration options:

graphite {
}

Available configuration options:

Setting Input type Required Default value

codec

codec

No

"plain"

enable_metric

boolean

No

true

exclude_metrics

array

No

["%{[^}]+}"]

fields_are_metrics

boolean

No

false

host

string

No

"localhost"

id

string

No

include_metrics

array

No

[".*"]

metrics

hash

No

{}

metrics_format

string

No

"*"

nested_object_separator

string

No

"."

port

number

No

2003

reconnect_interval

number

No

2

resend_on_failure

boolean

No

false

timestamp_field

string

No

"@timestamp"

workers

<<,>>

No

1

Details

edit

 

codec

edit
  • Value type is codec
  • Default value is "plain"

The codec used for output data. Output codecs are a convenient method for encoding your data before it leaves the output, without needing a separate filter in your Logstash pipeline.

enable_metric

edit
  • Value type is boolean
  • Default value is true

Disable or enable metric logging for this specific plugin instance by default we record all the metrics we can, but you can disable metrics collection for a specific plugin.

exclude_metrics

edit
  • Value type is array
  • Default value is ["%{[^}]+}"]

Exclude regex matched metric names, by default exclude unresolved %{field} strings.

fields_are_metrics

edit
  • Value type is boolean
  • Default value is false

An array indicating that these event fields should be treated as metrics and will be sent verbatim to Graphite. You may use either fields_are_metrics or metrics, but not both.

host

edit
  • Value type is string
  • Default value is "localhost"

The hostname or IP address of the Graphite server.

  • Value type is string
  • There is no default value for this setting.

Add a unique ID to the plugin instance, this ID is used for tracking information for a specific configuration of the plugin.

output {
 stdout {
   id => "ABC"
 }
}

If you don’t explicitely set this variable Logstash will generate a unique name.

include_metrics

edit
  • Value type is array
  • Default value is [".*"]

Include only regex matched metric names.

metrics

edit
  • Value type is hash
  • Default value is {}

The metric(s) to use. This supports dynamic strings like %{host} for metric names and also for values. This is a hash field with key being the metric name, value being the metric value. Example:

    metrics => { "%{host}/uptime" => "%{uptime_1m}" }

The value will be coerced to a floating point value. Values which cannot be coerced will be set to zero (0). You may use either metrics or fields_are_metrics, but not both.

metrics_format

edit
  • Value type is string
  • Default value is "*"

Defines the format of the metric string. The placeholder * will be replaced with the name of the actual metric.

    metrics_format => "foo.bar.*.sum"

If no metrics_format is defined, the name of the metric will be used as fallback.

nested_object_separator

edit
  • Value type is string
  • Default value is "."

When hashes are passed in as values they are broken out into a dotted notation For instance if you configure this plugin with # [source,ruby] metrics ⇒ "mymetrics"

and "mymetrics" is a nested hash of {a ⇒ 1, b ⇒ { c ⇒ 2 }} this plugin will generate two metrics: a ⇒ 1, and b.c ⇒ 2 . If you’ve specified a metrics_format it will respect that, but you still may want control over the separator within these nested key names. This config setting changes the separator from the . default.

port

edit
  • Value type is number
  • Default value is 2003

The port to connect to on the Graphite server.

reconnect_interval

edit
  • Value type is number
  • Default value is 2

Interval between reconnect attempts to Carbon.

resend_on_failure

edit
  • Value type is boolean
  • Default value is false

Should metrics be resent on failure?

timestamp_field

edit
  • Value type is string
  • Default value is "@timestamp"

Use this field for the timestamp instead of @timestamp which is the default. Useful when backfilling or just getting more accurate data into graphite since you probably have a cache layer infront of Logstash.

workers

edit
  • Value type is string
  • Default value is 1

TODO remove this in Logstash 6.0 when we no longer support the :legacy type This is hacky, but it can only be herne