Admin Manual

 


Route data to different places based on content

This documentation does not apply to the most recent version of Splunk. Click here for the latest version.

Route data to different places based on content

Enable routing to forward data from one Splunk instance to another based on content. For example, you can route data to systems based on sourcetype, a field you've extracted at index time, or the content of the raw event. Routing allows you to specifically distribute events to any system.

Configure routing

To set up routing:

Edit props.conf

Edit $SPLUNK_HOME/etc/system/local/props.conf and set a TRANSFORMS-routing= attribute:

[<spec>]
TRANSFORMS-routing=$UNIQUE_STANZA_NAME

<spec> can be:

Use the $UNIQUE_STANZA_NAME when creating your entry in transforms.conf (below).

Edit transforms.conf

Edit $SPLUNK_HOME/etc/system/local/transforms.conf and set rules to match your props.conf stanza:

[$UNIQUE_STANZA_NAME]
REGEX=$YOUR_REGEX
DEST_KEY=_TCP_ROUTING
FORMAT=$UNIQUE_GROUP_NAME

Edit outputs.conf

Edit $SPLUNK_HOME/etc/system/local/outputs.conf and set which tcpout outputs go to which servers or groups:

[tcpout:$UNIQUE_GROUP_NAME]
server=$IP:$PORT

Basic routing example

The following example sends all events with sourcetype="syslog" to one target group, all events that contain the word error to another target group, and everything else to a third target group.

1. Edit $SPLUNK_HOME/etc/system/local/props.conf and set a TRANSFORMS-routing= attribute:

[default]
TRANSFORMS-routing=errorRouting

[syslog]
TRANSFORMS-routing=syslogRouting

2. Edit $SPLUNK_HOME/etc/system/local/transforms.conf and set errorRouting and syslogRouting rules:

[errorRouting]
REGEX=error
DEST_KEY=_TCP_ROUTING
FORMAT=errorGroup

[syslogRouting]
REGEX=.
DEST_KEY=_TCP_ROUTING
FORMAT=syslogGroup

3. Edit $SPLUNK_HOME/etc/system/local/outputs.conf and set which tcpout outputs go to with servers or groups:

[tcpout]
defaultGroup=everythingElseGroup

[tcpout:syslogGroup]
server=10.1.1.197:9997

[tcpout:errorGroup]
server=10.1.1.200:9999

[tcpout:everythingElseGroup]
server=10.1.1.250:6666

Advanced routing example

This examples combines routing, data balancing and target group specific parameters. This outputs.conf sends all events with sourcetype="syslog" to one balanced target group, all events that contain the word error to a different target group, and clones everything else to two target groups. The heartbeat frequency for all target groups is dialed down to 10 seconds.

Note: Steps 1 and 2, props.conf and transforms.conf, are the same as the example above.

3. Edit $SPLUNK_HOME/etc/system/local/outputs.conf and set which tcpout outputs go to with servers or groups:

[tcpout]
defaultGroup=everythingElseGroup1, everthingElseGroup2
heartbeatFrequency=10

[tcpout:syslogGroup]
server=10.1.1.197:9997, 10.1.1.198:7777

[tcpout:errorGroup]
server=10.1.1.200:9999

[tcpout:everythingElseGroup1]
server=10.1.1.240:6666

[tcpout:everythingElseGroup2]
server=10.1.1.245:5555

Indexing and routing

In order to only route certain data while still indexing locally you'll need to make sure to configure your outputs.conf as follows:

[tcpout]
indexAndForward=true

This will ensure that your Splunk instance will keep of copy of the data it routes.

This documentation applies to the following versions of Splunk: 4.0 , 4.0.1 , 4.0.2 , 4.0.3 , 4.0.4 , 4.0.5 , 4.0.6 , 4.0.7 , 4.0.8 , 4.0.9 , 4.0.10 , 4.0.11 View the Article History for its revisions.


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

Was this documentation topic helpful?

If you'd like to hear back from us, please provide your email address:

We'd love to hear what you think about this topic or the documentation as a whole. Feedback you enter here will be delivered to the documentation team.

Feedback submitted, thanks!