Windex: Find Splunk apps that have index time operations


If a Splunk app has index-time operations, it has to be installed on the first heavy forwarder or indexer to perform those operations on the data that’s coming in. If it doesn’t have those operations, then it only needs to be installed on the search head to perform its search time operations on the data that’s found.

Simple right?

There is no comprehensive list of index-time operations.

So a few years ago I got annoyed after asking for such a list for the hundredth time or so, and I banged out a script that would answer the question. One caution is that there might be new index time operations since I wrote the script.

#!/bin/bash

# Script to figure out if index-time extractions are done.

# Run "./windex.sh | sort | uniq"

# Note that Bash is required.

# Online at https://pastebin.com/JVPsqcCV

# TODO: command line argument to set path instead of hard-coding ./splunk/etc/apps

# TODO: print the offending line number too?

echo "These add-ons have index-time field extractions."echo "================================================"

# http://docs.splunk.com/Documentation/Splunk/6.3.0/Indexer/Indextimeversussearchtime

# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Setadefaulthostforaninput

# Add-on sets host field.

echo "-----------------------------"

echo "Add-ons which set host field:"

echo "-----------------------------"

## Relevant conf files ##

# find splunk/etc/apps/ -name *.conf | grep Splunk_TA | grep default | egrep 'inputs|props|transforms' | grep -v .old

## Question at hand ###| xargs egrep '^host|host::' | egrep -v '_host|host_' | grep -v "#"## the resulting list of add-ons ###| awk 'BEGIN {FS="/"}; {print $4}'| uniq

find splunk/etc/apps/ -name *.conf | grep Splunk_TA | grep default | egrep 'inputs|props|transforms' | grep -v .old | xargs egrep '^host|host::' | egrep -v '_host|host_' | grep -v "#" | awk 'BEGIN {FS="/"}; {print $4}'| uniq

# http://docs.splunk.com/Documentation/Splunk/6.3.0/Indexer/Indextimeversussearchtime# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Bypassautomaticsourcetypeassignment# Add-on sets sourcetype field.

echo "---------------------------------------------------------------------------"echo "Add-ons which set sourcetype field (ignoring the old school eventgen ones):"echo "---------------------------------------------------------------------------"

## Sets sourcetype at all #### Relevant conf files ### find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | egrep 'inputs|props' | grep -v .old## Question at hand ###| xargs egrep '^sourcetype|sourcetype::' | grep -v "#"## Resulting list of add-ons ###| awk 'BEGIN {FS="/"}; {print $4}'| uniq | sort

## Sets sourcetype for the old school eventgen #### Relevant conf files ### find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | egrep 'inputs|props' | grep -v .old## Question at hand ### | xargs grep -A1 -e "^[source::.*]"| grep sourcetype## the resulting list of add-ons ### | awk '{FS="/"; print $4}'| uniq

## In the first list but not in the second list ### comm -23 <(list1) <(list2)

comm -23 <(find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | egrep 'inputs|props' | grep -v .old | xargs egrep '^sourcetype|sourcetype::' | grep -v "#" | awk '{FS="/"; print $4}'| sort | uniq) <(find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | egrep 'inputs|props' | grep -v .old | xargs grep -A1 -e "^[source::.*]"| grep sourcetype | awk 'BEGIN {FS="/"}; {print $4}' | sort | uniq)

# http://docs.splunk.com/Documentation/Splunk/6.3.0/Indexer/Indextimeversussearchtime# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Configureindex-timefieldextraction# Add-on uses TRANSFORMS- statement in props.conf.

echo "-------------------------------------------------"echo "Add-ons which use an explicit TRANSFORMS- stanza:"echo "-------------------------------------------------"

## Relevant conf files ### find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v .old## Question at hand ### | xargs grep -e ^TRANSFORMS- | grep -v "#"## The resulting list of add-ons ### | awk 'BEGIN {FS="/"}; {print $4}' | uniq

find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v .old | xargs grep -e ^TRANSFORMS- | grep -v "#" | awk 'BEGIN {FS="/"}; {print $4}'| uniq

# http://docs.splunk.com/Documentation/Splunk/6.3.0/Indexer/Indextimeversussearchtime# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Extractfieldsfromfileswithstructureddata# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Admin/Propsconf# Add-on uses indexed extractions

echo "--------------------------------------"echo "Add-ons which use Indexed Extractions:"echo "--------------------------------------"

## Relevant conf files ### find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v old## Question at hand ### | xargs grep -e ^INDEXED_EXTRACTIONS -e FIELD_DELIMITER | grep -v "#"## The resulting list of add-ons ### | awk 'BEGIN {FS="/"}; {print $4}' | uniq

find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v .old | xargs egrep '^INDEXED_EXTRACTIONS|FIELD_DELIMITER' | grep -v "#" | awk 'BEGIN {FS="/"}; {print $4}' | uniq

# http://docs.splunk.com/Documentation/Splunk/6.3.0/Indexer/Indextimeversussearchtime# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Handleeventtimestamps# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/HowSplunkextractstimestamps# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Admin/Propsconf# Add-on sets timestamp

echo "--------------------------------"echo "Add-ons which assign timestamps:"echo "--------------------------------"

## Relevant conf files ### find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v old## Question at hand ### | xargs grep -e ^TIME_FORMAT | grep -v "#"## The resulting list of add-ons ### | awk 'BEGIN {FS="/"}; {print $4}' | uniq

find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v .old | xargs grep -e ^TIME_FORMAT | grep -v "#" | awk 'BEGIN {FS="/"}; {print $4}' | uniq

# http://docs.splunk.com/Documentation/Splunk/6.3.0/Indexer/Indextimeversussearchtime# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Configureeventlinebreaking# Add-on sets line breaking

## Relevant conf files ### find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v old## Question at hand ### | xargs grep -e ^LINE_BREAKER -e ^SHOULD_LINEMERGE | grep -v "#"## The resulting list of add-ons ### | awk 'BEGIN {FS="/"}; {print $4}' | uniq

echo "--------------------------------------"echo "Add-ons which configure line breaking:"echo "--------------------------------------"

find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v .old | xargs grep -e ^LINE_BREAKER -e ^SHOULD_LINEMERGE | grep -v "#" | awk 'BEGIN {FS="/"}; {print $4}' | uniq

# http://docs.splunk.com/Documentation/Splunk/6.3.0/Indexer/Indextimeversussearchtime# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Abouteventsegmentation# -> http://docs.splunk.com/Documentation/Splunk/6.3.0/Data/Setthesegmentationforeventdata# Add-on sets segmentation behavior

## Relevant conf files ### find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v old## Question at hand ### | xargs grep -e ^SEGMENTATION | grep -v "#"## The resulting list of add-ons ### | awk 'BEGIN {FS="/"}; {print $4}' | uniq

echo "-------------------------------------------"echo "Add-ons which configure event segmentation:"echo "-------------------------------------------"

find splunk/etc/apps/ -name *.conf | grep Splunk_TA_ | grep default | grep props | grep -v .old | xargs grep -e ^SEGMENTATION | grep -v "#" | awk 'BEGIN {FS="/"}; {print $4}' | uniq

echo "==============================================================="echo "That's all as of 6.3 (Ember). Future Splunks may change things."

%d bloggers like this: