Quick Tip: Wildcard Sourcetypes in Props.conf

Tips & Tricks Jason Conger

Here is a quick one I use often. Here is an excerpt from props.conf.spec:

[<spec>]
* This stanza enables properties for a given <spec>.

<spec> can be:
1. <sourcetype>, the source type of an event.
2. host::<host>, where <host> is the host, or host-matching pattern, for an event.
3. source::<source>, where <source> is the source, or source-matching pattern, for an event.
4. rule::<rulename>, where <rulename> is a unique name of a source type classification rule.
5. delayedrule::<rulename>, where <rulename> is a unique name of a delayed source type
   classification rule.
These are only considered as a last resort before generating a new source type based on the
source seen.

However, I often want to wildcard a sourcetype for things like lookups. Here is an example, suppose I have the following sourcetypes:

It would be nice to have a stanza in props.conf that read something like:

CAUTION – THIS DOES NOT WORK

[acme:*]
LOOKUP-acme = lookup acme_users user_id AS user_id OUTPUTNEW user_name AS user_name FirstName AS FirstName LastName AS LastName

So that doesn’t work, but this regex magic does work:

[(?::){0}acme:*]
LOOKUP-acme = lookup acme_users user_id AS user_id OUTPUTNEW user_name AS user_name FirstName AS FirstName LastName AS LastName

Related Articles

Building custom search commands in Python part I – A simple Generating command
Tips & Tricks
4 Minute Read

Building custom search commands in Python part I – A simple Generating command

Custom search commands in our Python SDK allow you to extend Splunk’s search language and teach it new capabilities. In this and other upcoming posts we’re going to look at how to develop several different search commands to illustrate what you can do with this.
Order Up! | Custom Sort Orders
Tips & Tricks
4 Minute Read

Order Up! | Custom Sort Orders

A how-to on creating custom sort orders for your search results
Running as a Windows Service
Tips & Tricks
1 Minute Read

Running as a Windows Service

There are some things that are just plain difficult on a Windows box. Take, for example, debugging Splunk scripted inputs. It seems simple enough. But Splunk runs as a Windows Service and is usually running with the “NT AUTHORITY\SYSTEM” ID – a privileged account on the local machine, but with no privileges on the network.