influxdb

edit

This is a community-maintained plugin! It does not ship with Logstash by default, but it is easy to install by running bin/plugin install logstash-output-influxdb.

This output lets you output Metrics to InfluxDB (>= 0.9.0-rc31)

The configuration here attempts to be as friendly as possible and minimize the need for multiple definitions to write to multiple measurements and still be efficient

the InfluxDB API let’s you do some semblance of bulk operation per http call but each call is database-specific

You can learn more at InfluxDB homepage

 

Synopsis

edit

This plugin supports the following configuration options:

Required configuration options:

influxdb {
    data_points => ...
    host => ...
}

Available configuration options:

Setting Input type Required Default value

allow_time_override

boolean

No

false

codec

codec

No

"plain"

coerce_values

hash

No

{}

data_points

hash

Yes

{}

db

string

No

"statistics"

exclude_fields

array

No

["@timestamp", "@version", "sequence", "message", "type"]

flush_size

number

No

100

host

string

Yes

idle_flush_time

number

No

1

measurement

string

No

"logstash"

password

password

No

nil

port

number

No

8086

retention_policy

string

No

"default"

send_as_tags

array

No

["host"]

time_precision

string, one of ["n", "u", "ms", "s", "m", "h"]

No

"ms"

use_event_fields_for_data_points

boolean

No

false

user

string

No

nil

workers

number

No

1

Details

edit

 

allow_time_override

edit
  • Value type is boolean
  • Default value is false

Allow the override of the time column in the event?

By default any column with a name of time will be ignored and the time will be determined by the value of @timestamp.

Setting this to true allows you to explicitly set the time column yourself

Note: time must be an epoch value in either seconds, milliseconds or microseconds

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.

coerce_values

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

Allow value coercion

this will attempt to convert data point values to the appropriate type before posting otherwise sprintf-filtered numeric values could get sent as strings format is {'column_name' => 'datatype'}

currently supported datatypes are integer and float

data_points

edit
  • This is a required setting.
  • Value type is hash
  • Default value is {}

Hash of key/value pairs representing data points to send to the named database Example: {'column1' => 'value1', 'column2' => 'value2'}

Events for the same measurement will be batched together where possible Both keys and values support sprintf formatting

  • Value type is string
  • Default value is "statistics"

The database to write

exclude_fields

edit
  • Value type is array
  • Default value is ["@timestamp", "@version", "sequence", "message", "type"]

An array containing the names of fields from the event to exclude from the data points

Events, in general, contain keys "@version" and "@timestamp". Other plugins may add others that you’ll want to exclude (such as "command" from the exec plugin).

This only applies when use_event_fields_for_data_points is true.

flush_size

edit
  • Value type is number
  • Default value is 100

This setting controls how many events will be buffered before sending a batch of events. Note that these are only batched for the same measurement

host

edit
  • This is a required setting.
  • Value type is string
  • There is no default value for this setting.

The hostname or IP address to reach your InfluxDB instance

idle_flush_time

edit
  • Value type is number
  • Default value is 1

The amount of time since last flush before a flush is forced.

This setting helps ensure slow event rates don’t get stuck in Logstash. For example, if your flush_size is 100, and you have received 10 events, and it has been more than idle_flush_time seconds since the last flush, logstash will flush those 10 events automatically.

This helps keep both fast and slow log streams moving along in near-real-time.

measurement

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

Measurement name - supports sprintf formatting

password

edit
  • Value type is password
  • Default value is nil

The password for the user who access to the named database

port

edit
  • Value type is number
  • Default value is 8086

The port for InfluxDB

retention_policy

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

The retention policy to use

send_as_tags

edit
  • Value type is array
  • Default value is ["host"]

An array containing the names of fields to send to Influxdb as tags instead of fields. Influxdb 0.9 convention is that values that do not change every request should be considered metadata and given as tags.

time_precision

edit
  • Value can be any of: n, u, ms, s, m, h
  • Default value is "ms"

Set the level of precision of time

only useful when overriding the time value

use_event_fields_for_data_points

edit
  • Value type is boolean
  • Default value is false

Automatically use fields from the event as the data points sent to Influxdb

user

edit
  • Value type is string
  • Default value is nil

The user who has access to the named database

workers

edit
  • Value type is number
  • Default value is 1

The number of workers to use for this output. Note that this setting may not be useful for all outputs.