splunk-s2s: Send data to Splunk indexers

Send data to Splunk indexers over the Splunk-to-Splunk (S2S) protocol, the protocol of Splunk forwarders, using the network() destination.

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

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:

Terminal window
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 the splunk-s2s transport is 9997.
  • template(): The raw event. Use template("$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.