com.splunk
Class TcpInput

java.lang.Object
  extended by com.splunk.Resource
      extended by com.splunk.Entity
          extended by com.splunk.Input
              extended by com.splunk.TcpInput
All Implemented Interfaces:
java.util.Map<java.lang.String,java.lang.Object>

public class TcpInput
extends Input

The TcpInput class represents a raw TCP data input. This differs from a cooked TCP input in that this TCP input is in raw form, and is not processed (or "cooked").


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class com.splunk.Entity
toUpdate
 
Fields inherited from class com.splunk.Resource
actions, path, refreshArgs, service, title
 
Method Summary
 java.net.Socket attach()
          Returns a socket attached to this raw TCP input.
 void attachWith(ReceiverBehavior behavior)
          Submits events to this raw TCP input, reusing the connection.
 TcpConnections connections()
          Returns an object that contains the inbound raw TCP connections.
 java.lang.String getConnectionHost()
          Returns the style of host connection.
 java.lang.String getGroup()
          Returns the group of this raw TCP input.
 java.lang.String getHost()
          Returns the source host of this raw TCP input where this indexer gets its data.
 java.lang.String getIndex()
          Returns the index name of this raw TCP input.
 InputKind getKind()
          Returns the input kind of this input.
 int getPort()
          Returns the port that this input is listening on.
 java.lang.String getQueue()
          Returns the queue for this raw TCP input.
 int getRcvBuf()
          Deprecated. Returns the value of the _rcvbuf attribute for this TCP input.
 java.lang.String getRestrictToHost()
          Returns the incoming host restriction for this raw TCP input.
 java.lang.String getSource()
          Returns the initial source key for this raw TCP input.
 java.lang.String getSourceType()
          Returns the source type for events from this raw TCP input.
 boolean getSSL()
          Indicates whether this raw TCP input is using secure socket layer (SSL).
 void setConnectionHost(java.lang.String connection_host)
          Sets the value for the from-host field for the remote server that is sending data.
 void setDisabled(boolean disabled)
          Sets whether this input is enabled or disabled.
 void setHost(java.lang.String host)
          Sets the host from which the indexer gets data.
 void setIndex(java.lang.String index)
          Sets the index in which to store all generated events.
 void setQueue(java.lang.String queue)
          Sets how the input processor should deposit the events it reads.
 void setRawTcpDoneTimeout(int rawTcpDoneTimeout)
          Sets the timeout value for adding a Done key.
 void setSource(java.lang.String source)
          Sets the initial value for the source key for events from this input.
 void setSourceType(java.lang.String sourcetype)
          Sets the source type for events from this raw TCP input.
 void setSSL(boolean SSL)
          Sets whether to use secure socket layer (SSL).
 void submit(java.lang.String eventBody)
          Submit a single event to this raw TCP input by opening the connection, submitting the event, and closing the connection.
 void update(java.util.Map<java.lang.String,java.lang.Object> args)
          Updates the entity with the values you previously set using the setter methods, and any additional specified arguments.
 
Methods inherited from class com.splunk.Entity
actionPath, clear, containsKey, containsValue, disable, enable, entrySet, get, getMetadata, isDisabled, isEmpty, isNameChangeAllowed, keySet, put, putAll, refresh, remove, remove, size, update, validate, values
 
Methods inherited from class com.splunk.Resource
getName, getPath, getService, getTitle, invalidate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Method Detail

attach

public java.net.Socket attach()
                       throws java.io.IOException
Returns a socket attached to this raw TCP input.

Throws:
java.io.IOException

attachWith

public void attachWith(ReceiverBehavior behavior)
                throws java.io.IOException
Submits events to this raw TCP input, reusing the connection. This method passes an output stream connected to the index to the run method of the ReceiverBehavior object, then handles setting up and tearing down the socket. For an example of how to use this method, see How to get data into Splunk on dev.splunk.com.

Throws:
java.io.IOException

connections

public TcpConnections connections()
Returns an object that contains the inbound raw TCP connections.

Returns:
The TCP connections object.

getConnectionHost

public java.lang.String getConnectionHost()
Returns the style of host connection. Valid values are: "ip", "dns", and "none".

Returns:
The style of host connection, or null if not specified.

getGroup

public java.lang.String getGroup()
Returns the group of this raw TCP input.

Returns:
The group.

getHost

public java.lang.String getHost()
Returns the source host of this raw TCP input where this indexer gets its data.

Returns:
The source host, or null if not specified.

getIndex

public java.lang.String getIndex()
Returns the index name of this raw TCP input.

Returns:
The index name, or null if not specified.

getKind

public InputKind getKind()
Returns the input kind of this input.

Overrides:
getKind in class Input
Returns:
The input kind.

getQueue

public java.lang.String getQueue()
Returns the queue for this raw TCP input. Valid values are: "parsingQueue" and "indexQueue".

Returns:
The queue, or null if not specified.

getRcvBuf

public int getRcvBuf()
Deprecated. Returns the value of the _rcvbuf attribute for this TCP input.

Returns:
The _rcvbuf value.

getRestrictToHost

public java.lang.String getRestrictToHost()
Returns the incoming host restriction for this raw TCP input. When specified, this input only accepts data from the specified host.

Returns:
The incoming host restriction, or null if not specified.

getSource

public java.lang.String getSource()
Returns the initial source key for this raw TCP input. Typically this value is the input file path.

Returns:
The source key, or null if not specified.

getSourceType

public java.lang.String getSourceType()
Returns the source type for events from this raw TCP input.

Returns:
The source type, or null if not specified.

getSSL

public boolean getSSL()
Indicates whether this raw TCP input is using secure socket layer (SSL).

Returns:
true if this input is using SSL, false if not.

setSSL

public void setSSL(boolean SSL)
Sets whether to use secure socket layer (SSL).

Parameters:
SSL - true to use SSL, false if not.

setConnectionHost

public void setConnectionHost(java.lang.String connection_host)
Sets the value for the from-host field for the remote server that is sending data. Valid values are:

Parameters:
connection_host - The connection host information.

setDisabled

public void setDisabled(boolean disabled)
Sets whether this input is enabled or disabled.

Note: Using this method requires you to restart Splunk before this setting takes effect. To avoid restarting Splunk, use the Entity.disable and Entity.enable methods instead, which take effect immediately.

Parameters:
disabled - true to disable this input, false to enable it.

setHost

public void setHost(java.lang.String host)
Sets the host from which the indexer gets data.

Parameters:
host - The host name.

setIndex

public void setIndex(java.lang.String index)
Sets the index in which to store all generated events.

Parameters:
index - The index name.

submit

public void submit(java.lang.String eventBody)
            throws java.io.IOException
Submit a single event to this raw TCP input by opening the connection, submitting the event, and closing the connection. To submit multiple events, use attachWith to open a single connection.

Parameters:
eventBody - A string that contains the event.
Throws:
java.io.IOException
See Also:
attachWith(com.splunk.ReceiverBehavior)

setQueue

public void setQueue(java.lang.String queue)
Sets how the input processor should deposit the events it reads. Valid values are:

Parameters:
queue - The queue-processing type.

setRawTcpDoneTimeout

public void setRawTcpDoneTimeout(int rawTcpDoneTimeout)
Sets the timeout value for adding a Done key. If a connection over the input port specified by name remains idle after receiving data for this specified number of seconds, it adds a Done key, implying that the last event has been completely received.

Parameters:
rawTcpDoneTimeout - The timeout value, in seconds.

setSource

public void setSource(java.lang.String source)
Sets the initial value for the source key for events from this input. The source key is used during parsing and indexing. The source field is used for searches. As a convenience, the source string is prepended with "source::".

Note: Overriding the source key is generally not recommended. Typically, the input layer provides a more accurate string to aid in problem analysis and investigation, accurately recording the file from which the data was retrieved. Consider the use of source types, tagging, and search wildcards before overriding this value.

Parameters:
source - The source.

setSourceType

public void setSourceType(java.lang.String sourcetype)
Sets the source type for events from this raw TCP input.

Parameters:
sourcetype - The source type.

getPort

public int getPort()
Returns the port that this input is listening on.


update

public void update(java.util.Map<java.lang.String,java.lang.Object> args)
Updates the entity with the values you previously set using the setter methods, and any additional specified arguments. The specified arguments take precedent over the values that were set using the setter methods. Overrides the update method to additionally update this input's path if the RestrictToHost property is changed.

Overrides:
update in class Entity
Parameters:
args - The arguments to update.