Splunk® Enterprise

Forwarding Data

Splunk Enterprise version 8.2 is no longer supported as of September 30, 2023. See the Splunk Software Support Policy for details. For information about upgrading to a supported version, see How to upgrade Splunk Enterprise.

Set up load balancing

With load balancing, a forwarder distributes data across several receiving instances. Each receiver gets a portion of the total data, and together the receivers hold all the data. To access the full set of forwarded data, you need to set up distributed searching across all the receivers. See About distributed search in Distributed Search.

Load balancing enables horizontal scaling for improved performance. In addition, its automatic switchover capability ensures resiliency in the face of machine outages. If a host goes down, the forwarder sends data to the next available receiver.

Load balancing can also be of use when you get data from network devices like routers. To handle syslog and other data generated across TCP port 514, a single universal forwarder can monitor port 514 and distribute the incoming data across several indexers.

Note: You should not use an external load balancer to implement load balancing between forwarders and receivers. This practice does not generate the results you would expect. Use the load balancing capability that comes with the forwarder.

How load balancing works

Forwarders perform automatic load balancing. The forwarder routes data to different indexers on a specified time or volume interval that you can specify. For example, if you have a load-balanced group that consists of indexer A, B, and C, at a specified interval, the forwarder switches the data stream to another indexer in the group at random. The forwarder might switch from indexer B to indexer A to indexer C, and so on. If one indexer is down, the forwarder immediately switches to another.

There is a data stream for each of the inputs that the forwarder monitors. The forwarder determines if it is safe for a data stream to switch to another indexer. Then, at the specified interval, it switches the data stream to the newly selected indexer. If it cannot switch the data stream to the new indexer safely, it keeps the connection to the previous indexer open and continues to send the data stream until it has been safely sent.

Universal forwarders cannot switch indexers when they monitor TCP network streams of data unless the forwarder encounters an end-of-file (EOF) or the receiving indexer goes down. At that point, the forwarder switches to the next indexer in the list. Because the universal forwarder does not parse data and identify event boundaries before forwarding the data to the indexer (unlike a heavy forwarder), it does not know when it is safe to switch to the next indexer unless it receives an EOF.

The following diagram shows a typical load-balancing scenario, in which three forwarders are sending load-balanced data across a set of two receiving indexers:

30 admin13 forwardreceive-balance 60.png

Options for configuring receiving targets for load balancing

Specify static or DNS lists for receiving indexers

When you configure a set of target receivers for load balancing, you can choose either DNS or static lists.

DNS lists provide greater flexibility and allow for simplified scaling, particularly for large deployments. Through DNS, you can change the set of receivers without needing to re-edit each forwarder outputs.conf file.

Static lists let you specify a different port for each receiver. This is useful if you need to perform load balancing across multiple receivers that run on a single host, as each receiver can listen on a separate network port.

Choose a load balancing method

You can choose how you want the forwarders to load balance between the indexers in a load balancing list.

  • By time. The default method for load balancing is how frequently the forwarders change indexers in the load balanced list. The autoLBFrequency setting in outputs.conf controls how often forwarders switch between indexers. The default frequency is every 30 seconds, but you can set it higher or lower.
  • By volume. Another option is to set how much data a forwarder sends to an indexer before it switches between indexers in a load-balanced list. The autoLBVolume setting in outputs.conf controls the amount of data that a forwarder sends to a receiving indexer before it changes to another one. By default, this setting is not active (0 bytes.) If you set it to anything other than 0, then the forwarder will change indexers based on the amount of data that it has sent.


If you enable both settings, then the forwarder chooses an indexer based on the following logic:

  • If the forwarder has sent more than autoLBVolume bytes of data to an indexer, it changes indexers regardless of whether or not autoLBFrequency have passed since the last change to a receiving indexer.
  • If the forwarder has not sent more than autoLBVolume bytes of data before autoLBFrequency seconds have elapsed, then it changes indexers after that time has passed.

Specify a static list target

  1. On a forwarder that you want to set a static list target, edit $SPLUNK_HOME/etc/system/local/outputs.conf. You might have to create this file beforehand.
  2. In the outputs.conf file, specify each of the receivers in the target group [tcpout] stanza.
  3. Save the outputs.conf file.
  4. Restart the forwarder. The forwarder sends data to the static list targets.

Examples of a static load-balancing configuration file

In the following example, the target group consists of three receivers, specified by IP address and receiving port number. The universal forwarder balances load between the three receivers. If one receiver goes down, the forwarder switches to another one on the list.

[tcpout: my_LB_indexers]
server=10.10.10.1:9997,10.10.10.2:9996,10.10.10.3:9995


In the following example, the target group consists of four receivers, specified by IP address and receiving port number. The universal forwarder has been configured to send a specific amount of data (in this case, 1MB) to a receiver before it switches to another receiver in the list.

[tcpout: my_LB_indexers]
server=10.10.10.1:9997,10.10.10.2:9996,10.10.10.3:9995,10.10.10.4:9994
autoLBVolume=1048576


In the following example, the target group consists of three receivers. one with a DNS hostname and two with IP addresses. The universal forwarder has been configured to send data to one indexer for 3 minutes (180 seconds) before switching to another receiver.

[tcpout:My_LB_Indexers]
server=192.168.1.15:9997,192.168.1.179:9997,server1.mktg.example.com:9997
autoLBFrequency=180

Specify a DNS list target

  1. On a forwarder that you want to set a DNS list target, edit $SPLUNK_HOME/etc/system/local/outputs.conf. You might have to create this file beforehand.
  2. In the outputs.conf file, specify a single host in the target group [tcpout] stanza.
  3. Save the outputs.conf file.
  4. Restart the forwarder. The forwarder sends data to the DNS list targets.
  5. On your DNS server, create a DNS A record for each host IP address, referencing the server name you specified in outputs.conf..
    splunkreceiver.mycompany.com   A   10.10.10.1
    splunkreceiver.mycompany.com   A   10.10.10.2
    splunkreceiver.mycompany.com   A   10.10.10.3
    
  6. Reload the updated configuration on your DNS server. It might take a while for DNS changes to take effect, depending on the size of your network topology.

Examples of a DNS-based load-balancing configuration file

In the following example, the forwarder has been configured to send data to what appears to be a single host. The changes you made in DNS now have this hostname refer to three different IP addresses.

[tcpout:my_LB_indexers]
server=splunkreceiver.mycompany.com:9997

The forwarder uses the DNS list to load balance, sending data in intervals, switching among the receivers specified. If a receiver is not available, the forwarder skips it and sends data to another one on the list.

If you have a topology with many forwarders, the DNS list method lets you update the set of receivers by making changes on the DNS server, without having to edit outputs.conf.

Configure universal forwarder load balancing for horizontal scaling

When you configure load balancing for horizontal scaling, you should first determine your needs, particularly your horizontal scaling and whether or not you need failover. This helps you develop a topology based on those needs, which can include multiple forwarders as well as receivers and a search head to search across the receivers.

Set up DNS-based load balancing

This procedure assumes a topology of three universal forwarders and three receivers, and uses a DNS list to designate the receivers. For DNS-based load balancing to work, you must configure all receivers to listen on the same network port.

For more information on how to install universal forwarders, see Install the universal forwarder in the Universal Forwarder manual.

  1. Configure three machines to communicate on the network. This example uses the IP addresses 10.10.10.1, 10.10.10.2, and 10.10.10.3, but you can use addresses that are valid for your network.
  2. Install a set of three Splunk Enterprise instances as receivers.
  3. Configure receiving on the receivers. Specify the same receiving port. For example:
    ./splunk enable listen 9997 -auth <username>:<password>
    
  4. Install a set of universal forwarders.
  5. On your DNS server, set up a DNS list with an A record for each receiver IP address.
    splunkreceiver.mycompany.com   A   10.10.10.1
    splunkreceiver.mycompany.com   A   10.10.10.2
    splunkreceiver.mycompany.com   A   10.10.10.3
    
  6. Reload the updated configuration on your DNS server. It might take a while for DNS changes to take effect, depending on the size of your network topology.
  7. Create an outputs.conf file for all the forwarders to use. This example specifies the DNS server name used in the DNS list and the port the receivers are listening on.
    [tcpout]
    defaultGroup=my_LB_indexers
    
    [tcpout:my_LB_indexers]
    disabled=false
    autoLBFrequency=40
    server=splunkreceiver.mycompany.com:9997
    

    This outputs.conf file uses the autoLBFrequency attribute to set a load-balance frequency of 40 seconds. Every 40 seconds, the forwarders switch to another receiver. The default frequency is 30 seconds.

  8. Distribute the outputs.conf file to all the forwarders. You can use the deployment server to handle the distribution.

Specify load balancing from the CLI

You can also use the CLI to specify load balancing. You do this when you start forwarding activity to a set of receivers, using this syntax:

./splunk add forward-server <host>:<port> -method autobalance

where <host>:<port> is the host and receiver port of the receiver.

This example creates a load-balanced group of four receivers:

./splunk add forward-server indexer1:9997 -method autobalance
./splunk add forward-server indexer2:9997 -method autobalance
./splunk add forward-server indexer3:9997 -method autobalance
./splunk add forward-server indexer4:9997 -method autobalance
Last modified on 30 March, 2022
Upgrade heavy and light forwarders   Configure a forwarder to use a SOCKS proxy

This documentation applies to the following versions of Splunk® Enterprise: 8.2.6, 8.2.7, 8.2.8, 8.2.9, 8.2.10, 8.2.11, 8.2.12, 9.0.0, 9.0.1, 9.0.2, 9.0.3, 9.0.4, 9.0.5, 9.0.6, 9.0.7, 9.0.8, 9.0.9, 9.0.10, 9.1.0, 9.1.1, 9.1.2, 9.1.3, 9.1.4, 9.1.5, 9.1.6, 9.1.7, 9.2.0, 9.2.1, 9.2.2, 9.2.3, 9.2.4, 9.3.0, 9.3.1, 9.3.2


Was this topic useful?







You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters