tcp

Status: beta

Read events over a TCP socket.

Like stdin and file inputs, each event is assumed to be one line of text.

Can either accept connections from clients or connect to a server, depending on mode.

Synopsis

This is what it might look like in your config file:
input {
  tcp {
    add_field => ... # hash (optional), default: {}
    data_timeout => ... # number (optional), default: 5
    debug => ... # boolean (optional)
    format => ... # ["plain", "json", "json_event"] (optional)
    host => ... # string (optional), default: "0.0.0.0"
    message_format => ... # string (optional)
    mode => ... # ["server", "client"] (optional), default: "server"
    port => ... # number (required)
    tags => ... # array (optional)
    type => ... # string (required)
  }
}

Details

add_field

  • Value type is hash
  • Default value is {}

Add a field to an event

data_timeout

  • Value type is number
  • Default value is 5

Read timeout in seconds. If a particular tcp connection is idle for more than this timeout period, we will assume it is dead and close it. If you never want to timeout, use -1.

debug

  • Value type is boolean
  • There is no default value for this setting.

Set this to true to enable debugging on an input.

format

  • Value can be any of: "plain", "json", "json_event"
  • There is no default value for this setting.

The format of input data (plain, json, json_event)

host

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

When mode is server, the address to listen on. When mode is client, the address to connect to.

message_format

  • Value type is string
  • There is no default value for this setting.

If format is "json", an event sprintf string to build what the display @message should be given (defaults to the raw JSON). sprintf format strings look like %{fieldname} or %{@metadata}.

mode

  • Value can be any of: "server", "client"
  • Default value is "server"

Mode to operate in. server listens for client connections, client connects to a server.

port (required setting)

  • Value type is number
  • There is no default value for this setting.

When mode is server, the port to listen on. When mode is client, the port to connect to.

tags

  • Value type is array
  • There is no default value for this setting.

Add any number of arbitrary tags to your event.

This can help with processing later.

type (required setting)

  • Value type is string
  • There is no default value for this setting.

Label this input with a type. Types are used mainly for filter activation.

If you create an input with type "foobar", then only filters which also have type "foobar" will act on them.

The type is also stored as part of the event itself, so you can also use the type to search for in the web interface.


This is documentation from lib/logstash/inputs/tcp.rb