You can enable Splunk to accept an input on any TCP or UDP port. Splunk consumes any data sent on these ports. TCP is the protocol underlying Splunk's data distribution, which is the recommended method for sending data from any remote machine to your Splunk server.
Important: In version 3.3.3 of Splunk, default syslog processing via UDP does not correctly handle line-breaks. To work around this issue, add _linebreaker = _linebreaker to the UDP stanza in $SPLUNK_HOME/etc/system/local/inputs.conf. This issue was resolved in 3.3.4.
Splunk WebAdd inputs from network ports via Splunk Web.
1. Click Admin in the upper right-hand corner of Splunk Web.
2. Then click Data Inputs.
3. Pick Network Ports - Display and access configuration for UDP and TCP ports.
4. Click New Input to add an input.
5. Under the Source heading, select Protocol of UDP or TCP.
6. Accept the default port, 9998, or enter another port number.
7. Specify whether this port should accept connections from all hosts or one host. If you specify one host, enter the IP address of the host.
8. Now set the Source Type. Source type is a default field added to events. Source type is used to determine processing characteristics such as timestamps and event boundaries. Learn more about setting source type. Choose:
9. After specifying the source, host, and source type, click Submit.
CLIMonitor files and directories via Splunk's Command Line Interface (CLI). To use Splunk's CLI, navigate to the $SPLUNK_HOME/bin/ directory and use the ./splunk command. Or add Splunk to your path and use the splunk command.
If you get stuck, Splunk's CLI has built-in help. Access the main CLI help by typing splunk help. Individual commands have their own help pages as well -- type splunk help <command>.
The following commands are available for input configuration via the CLI:
| Command | Command syntax | Action |
| add | add tcp | udp $SOURCE [-parameter value] ... | Add inputs from $SOURCE. |
| edit | edit tcp | udp $SOURCE [-parameter value] ... | Edit a previously added input for $SOURCE. |
| remove | remove tcp | udp $SOURCE | Remove a previously added data input. |
| list | list tcp | udp | List the currently configured monitor. |
Change the configuration of each data input type by setting additional parameters. Parameters are set via the syntax: -parameter value.
Required parameters
| $SOURCE | Port number to listen for data to index. |
Optional parameters
| sourcetype | Specify a sourcetype field value for events from the input source. |
| index | Specify the destination index for events from the input source. |
| hostname | Specify a host name to set as the host field value for events from the input source. |
| remotehost | Specify an IP address to exclusively accept data from. |
| resolvehost | Set True of False (T | F). Default is False. Set True to use DNS to set the host field value for events from the input source. |
Configure a network input, then set the sourcetype:
Important: In version 3.3.3 of Splunk, default syslog processing via UDP does not correctly handle line-breaks. To work around this issue, add _linebreaker = _linebreaker to the UDP stanza in $SPLUNK_HOME/etc/system/local/inputs.conf. This issue was resolved in 3.3.4.
Check the Spunk Wiki for information about the best practices for using UDP when configuring Syslog input.
./splunk add udp 514 -sourcetype syslog
./splunk edit udp 514 -resolvehost true -auth admin:changeme
Note: Splunk must be running as root to watch ports under 1024.
inputs.confTo add an input, add a stanza for it to inputs.conf in $SPLUNK_HOME/etc/system/local/, or your own custom application directory in $SPLUNK_HOME/etc/apps/. If you have not worked with Splunk's configuration files before, read how configuration files work before you begin.
You can set any number of attributes and values following an input type. If you do not specify a value for one or more attributes, Splunk uses the defaults that are preset in $SPLUNK_HOME/etc/system/default/ (noted below).
TCP[tcp://<remote server>:<port>] <attrbute1> = <val1> <attrbute2> = <val2> ...
host = <string>
index = <string>
sourcetype = <string>
source = <string>
queue = <string> (parsingQueue, indexQueue, etc)
connection_host = [ip | dns]
Important: In version 3.3.3 of Splunk, default syslog processing via UDP does not correctly handle line-breaks. To work around this issue, add _linebreaker = _linebreaker to the UDP stanza in $SPLUNK_HOME/etc/system/local/inputs.conf. This was resolved in 3.3.4.
[udp://:<port>] <attrbute1> = <val1> <attrbute2> = <val2> ...
host = <string>
index = <string>
sourcetype = <string>
source = <string>
queue = <string> (parsingQueue, indexQueue, etc)
_rcvbuf = <int>
no_priority_stripping = true
no_appending_timestamp = true
Comments
@valente: Thanks for the feedback. I've fixed it.
Posted by emma on Dec 11 2008, 5:59pm
The CLI command summary above incorrectly refers to syntax of files and directories. This page is about Network ports.
Posted by valente on Dec 11 2008, 5:53pm