splunk-s2s: Receive data from Splunk forwarders

Receive data from Splunk Universal and Heavy Forwarders over the Splunk-to-Splunk (S2S) protocol using the network() source.

The splunk-s2s transport of the network() source acts as a Splunk indexer. Your Splunk forwarders can send their data to AxoSyslog over the Splunk-to-Splunk (S2S) protocol. Then you can process and route the data before you forward it.

To send data to a Splunk indexer over S2S, see splunk-s2s: Send data to Splunk indexers.

AxoSyslog can receive data from Splunk clients in two ways:

  • The splunk-s2s transport receives data from Splunk Universal and Heavy Forwarders over the S2S protocol.
  • The splunk-hec() source receives data from clients that send it over HTTP to the HTTP Event Collector (HEC), for example, from Splunk Connect for Syslog (SC4S).

Prerequisites

  • AxoSyslog version 4.30 or later.
  • This feature requires a separate module. Install the axosyslog-mod-splunk-s2s package on Debian/Ubuntu , or the axosyslog-splunk-s2s package on RHEL and compatible distributions . If the module isn’t installed, AxoSyslog fails to start with an unexpected LL_IDENTIFIER error .

  • Disable compression on the forwarders. AxoSyslog doesn’t support compressed S2S streams.

Example: Receiving data from a Splunk forwarder

The following source listens for S2S connections on port 9997, the default receiving port of Splunk indexers:

Terminal window
source s_splunk_forwarders {
  network(
    port(9997)
    transport("splunk-s2s")
    flags(no-parse)
  );
};

destination d_splunk_events {
  file("/var/log/splunk-events.log" template("${.splunk.sourcetype} ${HOST} ${MESSAGE}\n"));
};

log {
  source(s_splunk_forwarders);
  destination(d_splunk_events);
};

Use the flags(no-parse) option: the events of the forwarders aren’t syslog messages, and the syslog parser would modify them.

On the forwarder, add AxoSyslog as a receiver in the outputs.conf file, and disable compression, for example:

[tcpout]
defaultGroup = axosyslog

[tcpout:axosyslog]
server = <IP-of-AxoSyslog>:9997
compressed = false

To receive the data over TLS, add a tls() option to the source, and configure TLS on the forwarder.

How splunk-s2s processes the events

  • If the forwarder sends separate events, every event becomes a separate log message. Heavy Forwarders usually send their data this way.
  • If the forwarder sends raw chunks of data, AxoSyslog splits the chunks into lines, and every line becomes a separate log message. Universal Forwarders usually send the content of the monitored files this way. AxoSyslog doesn’t merge multi-line events.
  • The ${MESSAGE} macro contains the raw event or line, without a syslog header.
  • The timestamp of the message is the time of the event, if the forwarder sends it. Otherwise, it’s the time when AxoSyslog received the event.

AxoSyslog sets the following name-value pairs from the metadata of the event, if the forwarder sends them:

Name-value pair Splunk metadata
${.splunk.index} index
${.splunk.source} source
${.splunk.sourcetype} sourcetype
${.splunk.host} host

AxoSyslog also sets the ${HOST} macro to the host value of the event.

Acknowledgements to the forwarders

If the forwarder uses indexer acknowledgement (useACK = true in outputs.conf), AxoSyslog acknowledges every event when it receives the event.

CAUTION:

The acknowledgement doesn’t mean that AxoSyslog has stored the event. After the acknowledgement, the forwarder doesn’t resend the event. If AxoSyslog stops before it stores the event, the event is lost, also when you use flow control or 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() source apply, for example:

  • flags() : Use flags(no-parse).
  • log-msg-size() : The maximal size of a single event. If an event is larger, AxoSyslog logs an error and closes the connection. To accept the event and truncate it to log-msg-size() instead, set trim-large-messages(yes) .
  • port(): The default port of the splunk-s2s transport is 9997.
  • tls(): AxoSyslog starts the TLS handshake with the first byte of the connection.

Troubleshooting splunk-s2s connections

If the forwarder can’t send data to AxoSyslog, check the internal log of AxoSyslog for the following error messages.

The forwarder compresses the data. To fix it, set compressed = false in the outputs.conf file of the forwarder. The error message is one of the following:

  • splunk-s2s: the forwarder requested stream compression, which is not supported, set compressed=false in its outputs.conf
  • splunk-s2s: the forwarder speaks the legacy compressed protocol, which is not supported, set compressed=false in its outputs.conf
  • splunk-s2s: the forwarder compresses the stream, which is not supported, set compressed=false in its outputs.conf
  • splunk-s2s: the forwarder switched to stream compression, which is not supported, set compressed=false in its outputs.conf

Other error messages:

  • splunk-s2s: invalid greeting, the peer is probably not a Splunk forwarder: The client doesn’t use the S2S protocol. For example, it sends syslog messages or HEC requests to this port.
  • splunk-s2s: incoming event larger than log-msg-size(): Increase the log-msg-size() of the source, or set trim-large-messages(yes).
  • splunk-s2s: incoming packet larger than the receive buffer, increase log-msg-size(): A single packet of the forwarder is larger than the receive buffer of AxoSyslog. Increase the log-msg-size() of the source.