:plugin: collectd
:type: codec

///////////////////////////////////////////
START - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////
:version: %VERSION%
:release_date: %RELEASE_DATE%
:changelog_url: %CHANGELOG_URL%
:include_path: ../../../../logstash/docs/include
///////////////////////////////////////////
END - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////

[id="plugins-{type}s-{plugin}"]

=== Collectd codec plugin

include::{include_path}/plugin_header.asciidoc[]

==== Description

Read events from the collectd binary protocol over the network via udp.
See https://collectd.org/wiki/index.php/Binary_protocol

Configuration in your Logstash configuration file can be as simple as:
[source,ruby]
    input {
      udp {
        port => 25826
        buffer_size => 1452
        codec => collectd { }
      }
    }

A sample `collectd.conf` to send to Logstash might be:
[source,xml]
    Hostname    "host.example.com"
    LoadPlugin interface
    LoadPlugin load
    LoadPlugin memory
    LoadPlugin network
    <Plugin interface>
        Interface "eth0"
        IgnoreSelected false
    </Plugin>
    <Plugin network>
        Server "10.0.0.1" "25826"
    </Plugin>

Be sure to replace `10.0.0.1` with the IP of your Logstash instance.


[id="plugins-{type}s-{plugin}-options"]
==== Collectd Codec configuration options

[cols="<,<,<",options="header",]
|=======================================================================
|Setting |Input type|Required
| <<plugins-{type}s-{plugin}-authfile>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-nan_handling>> |<<string,string>>, one of `["change_value", "warn", "drop"]`|No
| <<plugins-{type}s-{plugin}-nan_tag>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-nan_value>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-prune_intervals>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-security_level>> |<<string,string>>, one of `["None", "Sign", "Encrypt"]`|No
| <<plugins-{type}s-{plugin}-target>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-typesdb>> |<<array,array>>|No
|=======================================================================

&nbsp;

[id="plugins-{type}s-{plugin}-authfile"]
===== `authfile` 

  * Value type is <<string,string>>
  * There is no default value for this setting.

Path to the authentication file. This file should have the same format as
the http://collectd.org/documentation/manpages/collectd.conf.5.shtml#authfile_filename[AuthFile]
in collectd. You only need to set this option if the `security_level` is set to
`Sign` or `Encrypt`

[id="plugins-{type}s-{plugin}-nan_handling"]
===== `nan_handling` 

  * Value can be any of: `change_value`, `warn`, `drop`
  * Default value is `"change_value"`

What to do when a value in the event is `NaN` (Not a Number)

- change_value (default): Change the `NaN` to the value of the nan_value option and add `nan_tag` as a tag
- warn: Change the `NaN` to the value of the nan_value option, print a warning to the log and add `nan_tag` as a tag
- drop: Drop the event containing the `NaN` (this only drops the single event, not the whole packet)

[id="plugins-{type}s-{plugin}-nan_tag"]
===== `nan_tag` 

  * Value type is <<string,string>>
  * Default value is `"_collectdNaN"`

The tag to add to the event if a `NaN` value was found
Set this to an empty string ('') if you don't want to tag

[id="plugins-{type}s-{plugin}-nan_value"]
===== `nan_value` 

  * Value type is <<number,number>>
  * Default value is `0`

Only relevant when `nan_handeling` is set to `change_value`
Change NaN to this configured value

[id="plugins-{type}s-{plugin}-prune_intervals"]
===== `prune_intervals` 

  * Value type is <<boolean,boolean>>
  * Default value is `true`

Prune interval records.  Defaults to `true`.

[id="plugins-{type}s-{plugin}-security_level"]
===== `security_level` 

  * Value can be any of: `None`, `Sign`, `Encrypt`
  * Default value is `"None"`

Security Level. Default is `None`. This setting mirrors the setting from the
collectd https://collectd.org/wiki/index.php/Plugin:Network[Network plugin]

[id="plugins-{type}s-{plugin}-target"]
===== `target`

  * Value type is <<string,string>>
  * There is no default value for this setting.

Define the target field for placing the decoded values. If this setting is not
set, data will be stored at the root (top level) of the event.

For example, if you want data to be put under the `document` field:
[source,ruby]
    input {
      udp {
        port => 12345
        codec => collectd {
          target => "[document]"
        }
      }
    }

[id="plugins-{type}s-{plugin}-typesdb"]
===== `typesdb` 

  * Value type is <<array,array>>
  * There is no default value for this setting.

File path(s) to collectd `types.db` to use.
The last matching pattern wins if you have identical pattern names in multiple files.
If no types.db is provided the included `types.db` will be used (currently 5.4.0).


