Splunk Cloud Platform

Search Reference

Acrobat logo Download manual as PDF


Acrobat logo Download topic as PDF

multisearch

Description

The multisearch command is a generating command that runs multiple streaming searches at the same time. This command requires at least two subsearches and allows only streaming operations in each subsearch. Examples of streaming searches include searches with the following commands: search, eval, where, fields, and rex. For more information, see Types of commands in the Search Manual.

Syntax

| multisearch <subsearch1> <subsearch2> <subsearch3> ...

Required arguments

<subsearch>
Syntax: "["search <logical-expression>"]"
Description: At least two streaming searches must be specified. See the search command for detailed information about the valid arguments for <logical-expression>.
To learn more, see About subsearches in the Search Manual.

Usage

The multisearch command is an event-generating command. See Command types.

Generating commands use a leading pipe character and should be the first command in a search.

The multisearch command doesn't support peer selection

You can't exclude search peers from multisearch searches because the multisearch command connects to all peers by default. For example, the following multisearch search connects to the indexer called myServer even though it is excluded using NOT:

| multisearch [ search index=_audit NOT splunk_server=myServer]

Instead of using the multisearch command to exclude search peers from your search, you can use other commands such as append with search optimization turned off. If you don't turn off search optimization, Splunk software might internally convert the append command to the multisearch command in order to optimize the search and might not exclude the search peers.

You can turn off search optimization for a specific search by including the following command at the end of your search:

|noop search_optimization=false

For example, the following workaround uses the append command to exclude myServer:

index=_internal splunk_server=myServer | append[| search index=_audit] | noop search_optimization=false

See Optimization settings in the Search Manual.

Subsearch processing and limitations

With the multisearch command, the events from each subsearch are interleaved. Therefore the multisearch command is not restricted by the subsearch limitations.

Unlike the append command, the multisearch command does not run the subsearch to completion first. The following subsearch example with the append command is not the same as using the multisearch command.

index=a | eval type = "foo" | append [search index=b | eval mytype = "bar"]

Examples

Example 1:

Search for events from both index a and b. Use the eval command to add different fields to each set of results.

| multisearch [search index=a | eval type = "foo"] [search index=b | eval mytype = "bar"]

See also

append, join

Last modified on 16 February, 2024
PREVIOUS
multikv
  NEXT
mvcombine

This documentation applies to the following versions of Splunk Cloud Platform: 8.2.2112, 8.2.2201, 8.2.2203, 9.0.2205, 8.2.2202, 9.0.2208, 9.0.2209, 9.0.2303, 9.0.2305 (latest FedRAMP release), 9.1.2308, 9.1.2312


Was this documentation topic helpful?


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