Splunk® Enterprise

Search Reference

Download manual as PDF

Splunk version 4.x reached its End of Life on October 1, 2013. Please see the migration information.
This documentation does not apply to the most recent version of Splunk. Click here for the latest version.
Download topic as PDF



Retrieves event metadata from indexes based on terms in the <logical-expression>.


metasearch [<logical-expression>]

Optional arguments

Syntax: <time-opts>|<search-modifier>|((NOT)? <logical-expression>)|<index-expression>|<comparison-expression>|(<logical-expression> (OR)? <logical-expression>)
Description: Includes time and search modifiers; comparison and index expressions.

Logical expression

Syntax: <field><cmp><value>
Description: Compare a field to a literal value or values of another field.
Syntax: "<string>"|<term>|<search-modifier>
Syntax: (<timeformat>)? (<time-modifier>)*

Comparison expression

Syntax: = | != | < | <= | > | >=
Description: Comparison operators.
Syntax: <string>
Description: The name of a field.
Syntax: <string> | <num>
Description: An exact, or literal, value of a field; used in a comparison expression.
Syntax: <lit-value> | <field>
Description: In comparison-expressions, the literal (number or string) value of a field or another field name.

Index expression

Syntax: <field-specifier>|<savedsplunk-specifier>|<tag-specifier>

Time options

Splunk allows many flexible options for searching based on time. For a list of time modifiers, see the topic "Time modifiers for search"

Syntax: timeformat=<string>
Description: Set the time format for starttime and endtime terms. By default, the timestamp is formatted: timeformat=%m/%d/%Y:%H:%M:%S .
Syntax: earliest=<time_modifier> | latest=<time_modifier>
Description: Specify start and end times using relative or absolute time. Read more about time modifier syntax in "Change the time range of your search"


Retrieves event metadata from indexes based on terms in the <logical-expression>. Metadata fields include source, sourcetype, host, _time, index, and splunk_server.


Example 1: Return metadata for events with "404" and from host "webserver1".

404 host="webserver1"

See also

metadata, search


Have questions? Visit Splunk Answers and see what questions and answers the Splunk community has using the metasearch command.


This documentation applies to the following versions of Splunk® Enterprise: 4.3, 4.3.1, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.3.6, 4.3.7

Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters