sample_rate parameter does not work for statsd output

Description

The statsd output has a sample_rate parameter.
The default value is 1 or 100% sampling.

But let's try to set 50% sampling.
If you use 0.5 without quotes, logstash gives a config file syntax error:

If you use a quotes value like '0.5', nothing to send to statsd. As suggested by 'Jon' on groups (https://groups.google.com/forum/#!topic/logstash-users/EMzzjJCVujM) the '0.5' seems to be converted to 0, or 'never'.

I work with 1.1.13. I guess 1.2.0 and 1.2.1 have the same issue as I have not seen any related codechanges.

Activity

Show:
Renzo Toma (moved to gchat)
October 8, 2013, 12:29 PM

Found the cause.
Logstash does not allow floats as parameter values (only 'string', 'number' and some unrelated).
If you apply the following patches setting the sample_rate will work:

Jordan Sissel
October 8, 2013, 1:34 PM

Thanks for your work to debug this!

The bug was that the logstash config parser was forcing 'number' validations to be integers. I've fixed it in master and this will show up in the next release.

Jordan Sissel
October 8, 2013, 2:39 PM

The problem is the plugin setting validation was turning 0.5 into 0 (a bug).

I've merged a fix into master and this will be available in the next release.

Fixed

Assignee

Jordan Sissel

Reporter

Renzo Toma (moved to gchat)

Labels

Fix versions

Affects versions

Configure