Why source types matter
The source type is one of the default fields that Splunk Enterprise assigns to all incoming data. It tells Splunk Enterprise what kind of data you've got, so that it can format the data intelligently during indexing. And it's a way to categorize your data, so that you can search it easily.
The important thing about source types
Because Splunk Enterprise uses the source type to decide how to format your data, it is important that you assign the correct source type to your data. That way, the indexed version of the data (the event data) looks the way you want, with appropriate timestamps and event breaks. This facilitates easier searching of the data later.
Splunk Enterprise comes with a large number of predefined source types. When consuming data, Splunk Enterprise will usually select the correct source type automatically. Sometimes, Splunk Enterprise needs your help. If your data is specialized, you might need to manually select a different predefined source type. If your data is unusual, you might need to create a new source type with customized event processing settings. And if your data source contains heterogeneous data, you might need to assign the source type on a per-event (rather than a per-source) basis.
Like any other field, you can also use the source type field to search event data, once the data has been indexed. You will use it a lot in your searches since the source type is a key way to categorize your data.
Typical source types
Any common data input format can be a source type. Most source types are log formats. For example, some common source types that Splunk Enterprise automatically recognizes include:
- access_combined, for NCSA combined format HTTP Web server logs.
- apache_error, for standard Apache Web server error logs.
- cisco_syslog, for the standard syslog produced by Cisco network devices (including PIX firewalls, routers, and ACS), usually via remote syslog to a central log host.
- websphere_core, a core file export from WebSphere.
For a longer list of source types that Splunk Enterprise automatically recognizes, see "List of pretrained source types" in this manual.
Configure source types
There are two basic types of configuration you can do with source types:
- Assign source types explicitly to your incoming data.
- Create new source types, either from scratch or by modifying an existing source type.
Assign source types
In most cases, Splunk Enterprise determines the best source type for your data and automatically assigns it to incoming events. In some cases, however, you might need to explicitly assign a source type to your data. You usually do this when defining the data input. For details on how to improve source type assignment, see:
- "Override automatic source type assignment"
- "Override source types on a per-event basis"
- "Configure rule-based source type recognition"
- "Create source types"
- "Rename source types"
Later in this topic, there is a section that explains how Splunk Enterprise assigns source types.
Create new source types
If none of the existing source types fits the needs of your data, create a new one.
Splunk Web provides a UI-based method for adjusting source type settings to fit your data. In essence, it's a visual source type editor. For detailed information, see "Assign the right source type to your data".
Preview data to test and modify source types
Splunk Web provides a way to view the effect of applying a source type to an input. It lets you preview the resulting events without actually committing them to an index. You can also edit timestamp and event breaking settings interactively and then save the modifications as a new source type.
Search on source types
sourcetype is the name of the source type search field. You can use the
sourcetype field to find similar types of data from any source type. For example, you could search
sourcetype=weblogic_stdout to find all of your WebLogic server events, even when WebLogic is logging from more than one domain (or "host," in Splunk terms).
How Splunk Enterprise assigns source types
Splunk Enterprise employs a variety of methods to assign source types to event data at index time. As it processes event data, Splunk Enterprise steps through these methods in a defined order of precedence. It starts with hardcoded source type configurations in
props.conf, moves on to rule-based source type association, and then works through methods like automatic source type recognition and automatic source type learning. This range of methods enables you to configure how Splunk Enterprise applies source type values to specific kinds of events, while letting Splunk Enterprise assign source type values to other events automatically.
The following list shows how Splunk Enterprise goes about determining the source type for a data input. Splunk Enterprise starts with the first method and then descends through the others as necessary, until it's able to determine the source type. The list also provides an overview on how you configure source type assignment for each level.
Explicit source type specification based on the data input
If Splunk Enterprise finds an explicit source type for the data input, it stops here.
You can also assign a source type when defining an input in Splunk Web. For information on doing this for file inputs, see "Use Splunk Web" in this manual. The process is similar for network or other types of inputs.
For more information, see "Specify source type for an input".
Explicit source type specification based on the data source
If Splunk Enterprise finds an explicit source type for the particular source, it stops here.
You configure this in props.conf, using this syntax:
For more information, see "Specify source type for a source".
Rule-based source type recognition
Splunk Enterprise looks next for any rules you've created for source types.
You can create source type classification rules in
[rule::<rule_name>] sourcetype=<sourcetype> MORE_THAN_[0-100] = <regex> LESS_THAN_[0-100] = <regex>
For information about setting up source type recognition rules, see "Configure rule-based source type recognition".
Automatic source type matching
Splunk Enterprise next attempts to use automatic source type recognition to match similar-looking files and assign a source type.
Splunk Enterprise calculates signatures for patterns in the first few thousand lines of any file or network input stream. These signatures identify things like repeating word patterns, punctuation patterns, line length, and so on. When Splunk Enterprise calculates a signature, it compares it to its set of signatures for known, "pretrained" source types. If it identifies a match, it assigns that source type to the data.
See "List of pretrained source types" in this manual for a list of the source types that Splunk Enterprise can recognize out of the box.
Delayed rule-based source type association
If Splunk Enterprise hasn't identified a source type by now, it looks for any delayed rules.
This works like rule-based associations (step 3, above). You create a
delayedrule:: stanza in
props.conf. This is a useful "catch-all" for source types, in case Splunk missed any with intelligent matching (see above).
A good use of delayed rule associations is for generic versions of very specific source types that were defined earlier with
rule:: in step 3, above. For example, you could use
rule:: to catch event data with specific syslog source types, such as "sendmail syslog" or "cisco syslog" and then have
delayedrule:: apply the generic "syslog" source type to the remaining syslog event data.
Here's the syntax:
[delayedrule::$RULE_NAME] sourcetype=$SOURCETYPE MORE_THAN_[0-100] = $REGEX LESS_THAN_[0-100] = $REGEX
For more information about settting up or removing delayed rules for source type recognition, see "Configure rule-based source type recognition".
Automatic source type learning
If Splunk Enterprise is unable to assign a source type for the event using the preceding methods, it creates a new source type for the event signature (see step 4, above). Splunk Enterprise stores learned pattern information in sourcetypes.conf.
Handle incorrectly-assigned host values
Override automatic source type assignment
This documentation applies to the following versions of Splunk® Enterprise: 6.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.0.9, 6.0.10, 6.0.11, 6.0.12, 6.0.13, 6.0.14, 6.0.15, 6.1, 6.1.1, 6.1.2, 6.1.3, 6.1.4, 6.1.5, 6.1.6, 6.1.7, 6.1.8, 6.1.9, 6.1.10, 6.1.11, 6.1.12, 6.1.13, 6.1.14, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.2.4, 6.2.5, 6.2.6, 6.2.7, 6.2.8, 6.2.9, 6.2.10, 6.2.11, 6.2.12, 6.2.13, 6.2.14, 6.2.15