splunk-s2s: Send data to Splunk indexers
The splunk-s2s transport of the network() destination
sends data to Splunk indexers over the Splunk-to-Splunk (S2S) protocol, the same way as a Splunk forwarder does. You can use it to replace a Splunk forwarder, without reconfiguring the receiving port of your indexers.
To send data to Splunk over HTTP, use the splunk-hec-event() destination
instead. To receive data from Splunk forwarders, see splunk-s2s: Receive data from Splunk forwarders.
Prerequisites
- AxoSyslog version 4.30 or later.
-
This feature requires a separate module. Install the
axosyslog-mod-splunk-s2spackage on Debian/Ubuntu , or theaxosyslog-splunk-s2spackage on RHEL and compatible distributions . If the module isn’t installed, AxoSyslog fails to start with anunexpected LL_IDENTIFIERerror . - A Splunk indexer that receives data on a port, usually port 9997. For details, see Enable a receiver in the Splunk documentation.
Example: Sending data to a Splunk indexer
The following destination sends the messages to a Splunk indexer. The rewrite rule sets the Splunk index and sourcetype of the events:
destination d_splunk_indexer {
network(
"splunk-indexer.example.com"
port(9997)
transport("splunk-s2s")
template("$MSG")
);
};
rewrite r_splunk_metadata {
set("network" value(".splunk.index"));
set("syslog" value(".splunk.sourcetype"));
};
log {
source(s_network);
rewrite(r_splunk_metadata);
destination(d_splunk_indexer);
};Use the template() option to set the raw event that the indexer receives. The default template of the network() destination adds a syslog header to the message.
How splunk-s2s sends the events
AxoSyslog sends every log message as a separate event. The raw event is the message formatted with the template() of the destination. The timestamp of the event is the timestamp of the message.
AxoSyslog takes the metadata of the event from the following name-value pairs:
| Splunk metadata | Name-value pair | Default if not set |
|---|---|---|
index |
${.splunk.index} |
main |
source |
${.splunk.source} |
axosyslog |
sourcetype |
${.splunk.sourcetype} |
axosyslog |
host |
${.splunk.host} |
The ${HOST} macro, or the hostname of the AxoSyslog host if ${HOST} is empty |
The splunk-s2s source
sets the same name-value pairs, so events that AxoSyslog receives from a Splunk forwarder keep their metadata.
Acknowledgements
AxoSyslog requests indexer acknowledgement. It considers an event delivered only when the indexer acknowledges it. If the connection breaks, AxoSyslog resends the events that the indexer hasn’t acknowledged yet. To keep these events if AxoSyslog restarts, use a disk-buffer .
Options of the splunk-s2s transport
The splunk-s2s transport doesn’t have options of its own. The options of the network() destination
apply, for example:
port(): The default port of thesplunk-s2stransport is 9997.template(): The raw event. Usetemplate("$MSG")to send only the message part.tls(): To send the data over TLS, configure TLS on the receiving port of the indexer as well. AxoSyslog starts the TLS handshake with the first byte of the connection.