:plugin: udp
:type: input
:default_codec: plain

///////////////////////////////////////////
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}"]

=== Udp input plugin

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

==== Description

Read messages as events over the network via udp. The only required
configuration item is `port`, which specifies the udp port logstash
will listen on for event streams.


[id="plugins-{type}s-{plugin}-ecs_metadata"]
===== Event Metadata and the Elastic Common Schema (ECS)

This plugin adds a field containing the source IP address of the UDP packet.
By default, the IP address is stored in the host field.
When {ecs-ref}[Elastic Common Schema (ECS)] is enabled (in
<<plugins-{type}s-{plugin}-ecs_compatibility>>), the source IP address is stored
in the [host][ip] field.

You can customize the field name using the <<plugins-{type}s-{plugin}-source_ip_fieldname>>.
See <<plugins-{type}s-{plugin}-ecs_compatibility>> for more information.


[id="plugins-{type}s-{plugin}-options"]
==== Udp Input Configuration Options

This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.

[cols="<,<,<",options="header",]
|=======================================================================
|Setting |Input type|Required
| <<plugins-{type}s-{plugin}-buffer_size>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-ecs_compatibility>> | <<string,string>>|No
| <<plugins-{type}s-{plugin}-host>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-port>> |<<number,number>>|Yes
| <<plugins-{type}s-{plugin}-queue_size>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-receive_buffer_bytes>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-source_ip_fieldname>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-workers>> |<<number,number>>|No
|=======================================================================

Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
input plugins.

&nbsp;

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

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

The maximum packet size to read from the network

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

* Value type is <<string,string>>
* Supported values are:
** `disabled`: unstructured connection metadata added at root level
** `v1`: structured connection metadata added under ECS compliant namespaces
* Default value depends on which version of Logstash is running:
** When Logstash provides a `pipeline.ecs_compatibility` setting, its value is used as the default
** Otherwise, the default value is `disabled`.

Controls this plugin's compatibility with the {ecs-ref}[Elastic Common Schema (ECS)].

The value of this setting affects the placement of a TCP connection's metadata on events.

.Metadata Location by `ecs_compatibility` value
[cols="<l,<l,e,<e"]
|=======================================================================
|`disabled`              |`v1`                      |Availability |Description

|host                    |[host][ip]                |Always       |Source IP of UDP packet
|=======================================================================

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

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

The address which logstash will listen on.

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

  * This is a required setting.
  * Value type is <<number,number>>
  * There is no default value for this setting.

The port which logstash will listen on. Remember that ports less
than 1024 (privileged ports) may require root or elevated privileges to use.

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

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

This is the number of unprocessed UDP packets you can hold in memory
before packets will start dropping.

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

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

The socket receive buffer size in bytes.
If option is not set, the operating system default is used.
The operating system will use the max allowed value if receive_buffer_bytes is larger than allowed.
Consult your operating system documentation if you need to increase this max allowed value.

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

* Value type is <<string,string>>
* Default value could be `"host"` or `[host][ip]` depending on the value of <<plugins-{type}s-{plugin}-ecs_compatibility>>

The name of the field where the source IP address will be stored.
See <<plugins-{type}s-{plugin}-ecs_metadata>> for more information on how ECS compatibility settings affect these defaults.

Example:
[source,ruby]
    input {
      udp {
        source_ip_fieldname => "[appliance][monitoring][ip]"
      }
    }

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

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

Number of threads processing packets

[id="plugins-{type}s-{plugin}-common-options"]
include::{include_path}/{type}.asciidoc[]

:default_codec!:
