Understanding and Using Fields in Splunk Searches
Learn how Splunk extracts fields, displays selected and interesting fields, and uses field values to narrow search results.
A field is a named piece of information extracted from or associated with an event. An event is one record of machine-generated data returned by a Splunk search. Fields make event data easier to identify, categorize, and filter.
For example, an event might contain status=failed user=alex. Splunk can treat status and user as fields, with failed and alex as their values.
What Fields Represent
Fields can describe the content of an event or metadata about the event. Event content fields represent information inside the logged message, such as a username, HTTP status, process ID, or transaction number.
Metadata fields describe where the event came from or how Splunk classifies it. Common metadata fields include host, source, and sourcetype. These fields provide context even when the raw event text does not clearly identify its origin.
| Field | What it identifies | Typical example | How it can be used in a search |
|---|---|---|---|
host | The system from which the event originated | web-server-01 | host="web-server-01" |
source | The input origin, such as a file or stream | /var/log/auth.log | source="/var/log/auth.log" |
sourcetype | The format or category of the event data | access_combined | sourcetype="access_combined" |
Automatic Field Extraction
Field extraction is the process of recognizing a value in event data and assigning it a field name. Splunk can identify and extract fields while processing search results. A common source is a key-value pair: a field name associated with a value, often written as key=value.
For example, an event containing status=failed may provide a status field, and an event containing user=alex may provide a user field. The exact fields available depend on the event format, the data being searched, and the events returned by the current search.
Field availability is therefore result-dependent. A field may appear for one search but not another because the second search returns different event types or no events containing that field. Automatic extraction also does not guarantee that every possible value in the raw text becomes a field.
The Fields Sidebar in the Search App
After running a search that returns events, inspect the fields panel in the Search app. The panel lists extracted fields and helps you examine the values found in the current results.
- Run a broad search over a suitable time range.
- Locate the fields panel beside the event results.
- Review the Selected fields section and the Interesting fields section.
- Expand a field to view values found in the returned events.
Value counts and value listings describe the matching event set for the current search and time range. They do not represent every value that exists in the entire Splunk environment.
Selected Fields
Selected fields are fields shown by default in the search interface. The standard metadata fields are usually host, source, and sourcetype.
host identifies the originating system. source identifies the input origin, such as a log file path or stream. sourcetype identifies the event format or classification. Together, these fields provide a quick view of where an event came from and what kind of data it contains.
Interesting Fields
Interesting fields are fields Splunk highlights because their values or patterns appear useful in the current result set. A field can become interesting because it occurs repeatedly, contains varied values, or helps describe the returned events.
Interesting fields differ from selected fields. Selected fields are default interface fields, especially core metadata. Interesting fields are identified from the current data, so changing the search or time range can cause an interesting field to appear or disappear.
| Characteristic | Selected fields | Interesting fields |
|---|---|---|
| How the field appears | Displayed by default in the Search app | Highlighted as potentially useful for the current results |
| Typical contents | Core metadata such as host, source, and sourcetype | Extracted content fields such as status, user, or an application-specific field |
| Dependence on current results | Generally available as standard event context | Strongly dependent on the events returned by the current search |
| Primary use | Quickly identify event origin and classification | Inspect useful values and build more focused searches |
Filtering Searches with Field Values
Selecting a field value in the results interface adds a search constraint. A search constraint is a condition that limits which events match. Conceptually, a field filter has the form:
field_name=field_valueFor example, selecting a host value can add an equivalent condition such as:
host="web-server-01"The search now returns events whose host field matches that hostname. Selecting a value from the sidebar is not merely a display choice; it adds a term to the search expression.
| Goal | Field constraint | Expected effect |
|---|---|---|
| Show one host | host="web-server-01" | Return events originating from that system |
| Show one source | source="/var/log/auth.log" | Return events from the specified input |
| Show one sourcetype | sourcetype="access_combined" | Return events classified with that event format |
| Combine conditions | host="web-server-01" sourcetype="access_combined" | Return events matching both metadata conditions |
Field Filtering Workflow
- Start broadly. Run a search that returns events over an appropriate time range.
- Inspect context. Review selected fields, especially
host,source, andsourcetype. - Inspect discovered data. Review interesting fields such as
statusoruser. - Open a field. Expand it to see values found in the current results.
- Choose a value. Select a hostname, status, username, or other value to add a constraint.
- Review the expression. Confirm the generated field condition in the search bar.
- Compare results. Rerun or update the search and verify that the matching event set is narrower.
- Adjust when necessary. Remove a constraint or choose another value if the filter is too restrictive.
Example: Filtering by Host
Suppose the initial search returns events from several systems. Open the host field, inspect its available values, and select web-server-01. Splunk adds an equivalent condition:
host="web-server-01"The updated results contain events whose origin system is that host. This is different from filtering by source, which would select an input such as a particular file, or by sourcetype, which would select a data classification.
Example: Filtering an Extracted Key-Value Field
Consider events containing status=failed or user=alex. If status appears as an interesting field, expand it and inspect the values returned by the current search. Selecting failed adds a condition equivalent to:
status="failed"Compare the broad result set with the filtered set. The filtered search should contain only events whose extracted status value is failed.
Combining Field Conditions
Multiple field terms narrow the result set. For example:
host="web-server-01" sourcetype="access_combined"This is an AND-style search: an event must satisfy both conditions. To match either of two hosts, use a Boolean expression:
host="web-server-01" OR host="web-server-02"Boolean expressions combine or exclude conditions with logical operators such as AND, OR, and NOT. Use them when a simple sequence of field terms is not enough to express the desired result.
Field Filters and Pipes
A pipe is the vertical bar character, |. It passes the results of a base search to a later Splunk search-processing command. Field constraints belong to the base search before the pipe:
host="web-server-01" | <search command>The field condition determines which events enter the later command. The pipe does not itself filter a field; it separates the base search from subsequent processing.
Troubleshooting Fields and Filters
An Expected Field Is Not Visible
- The current search may return no events containing that field.
- The event format may not be automatically extracted into the expected field.
- The field may not currently be selected or highlighted as interesting.
Inspect the raw event text for the expected value and structure. Broaden the base search or time range when appropriate. Check the available field list instead of assuming that every event contains the same fields.
A Field Filter Returns No Results
- The selected value may not occur in the chosen time range.
- An earlier constraint may conflict with the new condition.
- The value may contain incorrect spelling, capitalization, or quoting.
Review the generated search expression. Remove constraints one at a time to find the condition that is too restrictive. Selecting values directly from the field sidebar can reduce typing errors.
Results Are Not Limited to the Expected Machine or Input
Confirm that the correct metadata field is being used: host for the origin system, source for the input origin, and sourcetype for the event format. Naming conventions can make these values seem similar, so inspect all three fields on sample events before filtering.
An Interesting Field Disappears
Interesting fields are determined from the current result set. Changing the search or time range can remove the events that contained the field. Treat the field list as a description of the current results, and broaden or adjust the search when you need to find it again.
Exam-Relevant Notes
- A field is a named attribute extracted from or associated with an event.
host,source, andsourcetypeare important event metadata fields.- Key-value patterns such as
status=failedare common sources of automatic field extraction. - Selected fields are default interface fields; interesting fields depend on the current result set.
- Choosing a field value adds a real search constraint in the form
field=value. - Multiple field constraints narrow results, Boolean operators combine alternatives, and pipes pass results to later commands.
For prerequisite navigation, see Launch Search App and Time Range Picker. For related syntax, see Boolean Expressions and Pipes.