About default fields (host, source, sourcetype, and more)
When Splunk software indexes data, it tags each event with a number of fields. These fields become part of the index event data. The fields that are added automatically are known as default fields.
Default fields serve a number of purposes:
- The default field
index
identifies the index in which the event is located. - The default field
linecount
describes the number of lines the event contains. - The default field
timestamp
specifies the time at which the event occurred.
Splunk software uses the values in some of the fields, particularly sourcetype
, when indexing the data, in order to create events properly. Once the data has been indexed, you can use the default fields in your searches.
The complete list of default fields follows:
Type of field | List of fields | Description |
---|---|---|
Internal fields | _raw, _time, _indextime, _cd
|
These fields contain information that Splunk software uses for its internal processes. |
Basic default fields | host, index, linecount, punct, source, sourcetype, splunk_server, timestamp
|
These fields provide basic information about an event, such as where it originated, what kind of data it contains,what index it's located in, how many lines it contains, and when it occurred. |
Default datetime fields | date_hour, date_mday, date_minute, date_month, date_second, date_wday, date_year, date_zone
|
These fields provide additional searchable granularity to event timestamps.
Note: Only events that have timestamp information in them as generated by their respective systems will have date_* fields. If an event has a date_* field, it represents the value of time/date directly from the event itself. If you have specified any timezone conversions or changed the value of the time/date at indexing or input time (for example, by setting the timestamp to be the time at index or input time), these fields will not represent that. |
For information about default fields from the search perspective, see Use default fields in the Knowledge Manager Manual.
You can also specify additional, custom fields for inclusion in the index. See Create custom fields at index-time in this chapter.
This topic focuses on three key default fields:
Defining host, source, and sourcetype
The host, source, and sourcetype fields are defined as follows:
- host - An event host value is typically the hostname, IP address, or fully qualified domain name of the network host from which the event originated. The host value lets you locate data originating from a specific device. For more information on hosts, see About hosts.
- source - The source of an event is the name of the file, stream, or other input from which the event originates. For data monitored from files and directories, the value of source is the full path, such as
/archive/server1/var/log/messages.0
or/var/log/
. The value of source for network-based data sources is the protocol and port, such as UDP:514. - sourcetype - The source type of an event is the format of the data input from which it originates, such as
access_combined
orcisco_syslog
. The source type determines how your data is to be formatted. For more information on source types, see Why source types matter.
Source vs sourcetype
Source and source type are both default fields, but they are entirely different otherwise, and can be easily confused.
- The source is the name of the file, stream, or other input from which a particular event originates.
- The sourcetype determines how Splunk software processes the incoming data stream into individual events according to the nature of the data.
Events with the same source type can come from different sources, for example, if you monitor source=/var/log/messages
and receive direct syslog input from udp:514
. If you search sourcetype=linux_syslog
, events from both of those sources are returned.
Under what conditions should you override host and sourcetype assignment?
Much of the time, Splunk software can automatically identify host and sourcetype values that are both correct and useful. But situations do come up that require you to intervene in this process and provide override values.
Override host assignment
You might want to change your default host
assignment when:
- You load archive data in bulk that was originally generated from a different host and you want those events to have that host value.
- You forward data from a different host. (The forwarder assigns its host name unless you specify otherwise.)
- You are working with a centralized log server environment, which means that all of the data received from that server will have the same host, even if it originated elsewhere.
For detailed information about hosts, see the chapter Configure host values.
Override sourcetype assignment
You might want to change your default sourcetype
assignment when:
- Splunk software cannot automatically format the data properly, resulting in problems such as wrong timestamping or event linebreaking.
- You want to apply source types to specific events coming through a particular input, such as events that originate from a discrete group of hosts, or even events that are associated with a particular IP address or userid.
There are also steps you can take to expand the range of source types that Splunk software automatically recognizes, or to simply rename source types.
About indexed field extraction | Assign default fields dynamically |
This documentation applies to the following versions of Splunk® Enterprise: 7.0.0, 7.0.1, 7.0.2, 7.0.3, 7.0.4, 7.0.5, 7.0.6, 7.0.7, 7.0.8, 7.0.9, 7.0.10, 7.0.11, 7.0.13, 7.1.0, 7.1.1, 7.1.2, 7.1.3, 7.1.4, 7.1.5, 7.1.6, 7.1.7, 7.1.8, 7.1.9, 7.1.10, 7.2.0, 7.2.1, 7.2.2, 7.2.3, 7.2.4, 7.2.5, 7.2.6, 7.2.7, 7.2.8, 7.2.9, 7.2.10, 7.3.0, 7.3.1, 7.3.2, 7.3.3, 7.3.4, 7.3.5, 7.3.6, 7.3.7, 7.3.8, 7.3.9, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.0.5, 8.0.6, 8.0.7, 8.0.8, 8.0.9, 8.0.10, 8.1.0, 8.1.1, 8.1.2, 8.1.3, 8.1.4, 8.1.5, 8.1.6, 8.1.7, 8.1.8, 8.1.9, 8.1.11, 8.2.0, 8.2.1, 8.2.2, 8.2.3, 8.2.4, 8.2.5, 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, 8.1.10, 8.1.12, 8.1.13, 8.1.14
Feedback submitted, thanks!