/** * Indicates whether this raw TCP input is using secure socket layer (SSL). * * @return {@code true} if this input is using SSL, {@code false} if not. */ public boolean getSSL() { return getBoolean("SSL", false); }
/** * @deprecated Returns the value of the {@code _rcvbuf} attribute for this * TCP input. * * @return The {@code _rcvbuf} value. */ public int getRcvBuf() { return getInteger("_rcvbuf"); }
/** * Returns the queue for this raw TCP input. Valid values are: * "parsingQueue" and "indexQueue". * * @return The queue, or {@code null} if not specified. */ public String getQueue() { return getString("queue", null); }
/** * 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 {@code attachWith} to open a single connection. * @see #attachWith * * @param eventBody A string that contains the event. */ public void submit(String eventBody) throws IOException { Socket socket = null; OutputStream output = null; try { socket = attach(); output = socket.getOutputStream(); output.write(eventBody.getBytes("UTF-8")); output.flush(); output.close(); socket.close(); } finally { if (output != null) { output.close(); } if (socket != null) { socket.close(); } } }
/** * Sets whether to use secure socket layer (SSL). * * @param SSL {@code true} to use SSL, {@code false} if not. */ public void setSSL(boolean SSL) { setCacheValue("SSL", SSL); }
/** * Returns a socket attached to this raw TCP input. */ public Socket attach() throws IOException { return new Socket(this.service.getHost(), this.getPort()); }
/** * Submits events to this raw TCP input, reusing the connection. * * This method passes an output stream connected to the index to the * {@code run} method of the {@code ReceiverBehavior} object, then handles * setting up and tearing down the socket. * For an example of how to use this method, see * <a href="http://dev.splunk.com/view/SP-CAAAEJ2" target="_blank">How to * get data into Splunk</a> on * <a href="http://dev.splunk.com/view/SP-CAAAEJ2" * target="_blank">dev.splunk.com</a>. */ public void attachWith(ReceiverBehavior behavior) throws IOException { Socket socket = null; OutputStream output = null; try { socket = attach(); output = socket.getOutputStream(); behavior.run(output); output.flush(); } finally { if (output != null) { output.close(); } if (socket != null) { socket.close(); } } }
/** * Sets the host from which the indexer gets data. * * @param host The host name. */ public void setHost(String host) { setCacheValue("host", host); }
@Override public void setup(OperatorContext context) { super.setup(context); tcpInput = (TcpInput)store.getService().getInputs().get(tcpPort); try { socket = tcpInput.attach(); stream = new DataOutputStream(socket.getOutputStream()); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Sets the index in which to store all generated events. * * @param index The index name. */ public void setIndex(String index) { setCacheValue("index", index); }
/** * Returns the index name of this raw TCP input. * * @return The index name, or {@code null} if not specified. */ public String getIndex() { return getString("index", null); }
@Override public void setup(OperatorContext context) { super.setup(context); tcpInput = (TcpInput) store.getService().getInputs().get(tcpPort); try { socket = tcpInput.attach(); stream = new DataOutputStream(socket.getOutputStream()); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Sets the source type for events from this raw TCP input. * * @param sourcetype The source type. */ public void setSourceType(String sourcetype) { setCacheValue("sourcetype", sourcetype); } }
/** * Returns the incoming host restriction for this raw TCP input. When * specified, this input only accepts data from the specified host. * * @return The incoming host restriction, or {@code null} if not specified. */ public String getRestrictToHost() { return getString("restrictToHost", null); }
/** * Sets how the input processor should deposit the events it reads. Valid * values are:<ul> * <li>"parsingQueue": Applies props.conf and other parsing rules to your * data.</li> * <li>"indexQueue": Sends your data directly into the index.</li></ul> * * @param queue The queue-processing type. */ public void setQueue(String queue) { setCacheValue("queue", queue); }
/** * Returns the style of host connection. Valid values are: "ip", "dns", and * "none". * * @return The style of host connection, or {@code null} if not specified. */ public String getConnectionHost() { return getString("connection_host", null); }
/** * Sets the timeout value for adding a Done key. * * If a connection over the input port specified by {@code 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. * * @param rawTcpDoneTimeout The timeout value, in seconds. */ public void setRawTcpDoneTimeout(int rawTcpDoneTimeout) { setCacheValue("rawTcpDoneTimeout", rawTcpDoneTimeout); }
/** * Returns the group of this raw TCP input. * * @return The group. */ public String getGroup() { return getString("group", null); }
/** * Sets the value for the <b>from-host</b> field for the remote server that * is sending data. Valid values are: <ul> * <li>"ip": Sets the host to the IP address of the remote server sending * data.</li> * <li>"dns": Sets the host to the reverse DNS entry for the IP address of * the remote server sending data.</li> * <li>"none": Leaves the host as specified in inputs.conf, which is * typically the Splunk system host name.</li></ul> * * @param connection_host The connection host information. */ public void setConnectionHost(String connection_host) { setCacheValue("connection_host", connection_host); }
/** * Returns the source host of this raw TCP input where this indexer gets its * data. * * @return The source host, or {@code null} if not specified. */ public String getHost() { return getString("host", null); }