For other versions, see theVersioned plugin docs.
For plugins not bundled by default, it is easy to install by running bin/logstash-plugin install logstash-output-statsd
. See Working with plugins for more details.
For questions about the plugin, open a topic in the Discuss forums. For bugs or feature requests, open an issue in Github.For the list of Elastic supported plugins, please consult the Elastic Support Matrix.
statsd is a network daemon for aggregating statistics, such as counters and timers,and shipping over UDP to backend services, such as Graphite or Datadog. The generalidea is that you send metrics to statsd and every few seconds it will emit theaggregated values to the backend. Example aggregates are sums, average and maximumvalues, their standard deviation, etc. This plugin makes it easy to send suchmetrics based on data in Logstash events.
You can learn about statsd here:
Typical examples of how this can be used with Logstash include counting HTTP hitsby response code, summing the total number of bytes of traffic served, and trackingthe 50th and 95th percentile of the processing time of requests.
Each metric emitted to statsd has a dot-separated path, a type, and a value. Themetric path is built from the namespace
and sender
options together with themetric name that’s picked up depending on the type of metric. All in all, themetric path will follow this pattern:
namespace.sender.metric
With regards to this plugin, the default namespace is "logstash", the defaultsender is the host
field, and the metric name depends on what is set as themetric name in the increment
, decrement
, timing
, count
, set
or gauge
options. In metric paths, colons (":"), pipes ("|") and at signs ("@") are reservedand will be replaced by underscores ("_").
Example:
output { statsd { host => "statsd.example.org" count => { "http.bytes" => "%{bytes}" } }}
If run on a host named hal9000 the configuration above will send the followingmetric to statsd if the current event has 123 in its bytes
field:
logstash.hal9000.http.bytes:123|c
This plugin supports the following configuration options plus the Common Options described later.
Setting | Input type | Required |
---|---|---|
No |
||
No |
||
No |
||
No |
||
No |
||
No |
||
No |
||
No |
||
No |
||
No |
||
No |
Also see Common Options for a list of options supported by alloutput plugins.
{}
A count metric. metric_name => count
as hash. %{fieldname}
substitutions areallowed in the metric names.
[]
A decrement metric. Metric names as array. %{fieldname}
substitutions areallowed in the metric names.
{}
A gauge metric. metric_name => gauge
as hash. %{fieldname}
substitutions areallowed in the metric names.
"localhost"
The hostname or IP address of the statsd server.
[]
An increment metric. Metric names as array. %{fieldname}
substitutions areallowed in the metric names.
"logstash"
The statsd namespace to use for this metric. %{fieldname}
substitutions areallowed.
"udp"
The protocol to connect to on your statsd server.
"%{host}"
The name of the sender. Dots will be replaced with underscores. %{fieldname}
substitutions are allowed.
{}
A set metric. metric_name => "string"
to append as hash. %{fieldname}
substitutions are allowed in the metric names.
{}
A timing metric. metric_name => duration
as hash. %{fieldname}
substitutionsare allowed in the metric names.
The following configuration options are supported by all output plugins:
"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.
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 collectionfor a specific plugin.
Add a unique ID
to the plugin configuration. If no ID is specified, Logstash will generate one.It is strongly recommended to set this ID in your configuration. This is particularly usefulwhen you have two or more plugins of the same type. For example, if you have 2 statsd outputs.Adding a named ID in this case will help in monitoring Logstash when using the monitoring APIs.
output { statsd { id => "my_plugin_id" }}