Splunk Search

Difference between outputs of same query as search and subsearch

ebarnhill
Engager

Noob here. Can anyone tell me why the following search:

search sourcetype=srt  | table serialNumber

will give me a one-column table of serial numbers as expected, while the same query in subsearch brackets

[search sourcetype=srt  | table serialNumber]

does not return the same table that I expect, but rather returns the full record?

Labels (1)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @ebarnhill,

Subsearch outputs are formatted as search string. In your case the result is 

serialNumber=serialNumber1 OR serialNumber=serialNumber2 OR ...

You can test the subsearch output by adding format command end of the normal search

search sourcetype=srt  | table serialNumber | format
If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

scelikok
SplunkTrust
SplunkTrust

Hi @ebarnhill,

Subsearch outputs are formatted as search string. In your case the result is 

serialNumber=serialNumber1 OR serialNumber=serialNumber2 OR ...

You can test the subsearch output by adding format command end of the normal search

search sourcetype=srt  | table serialNumber | format
If this reply helps you an upvote and "Accept as Solution" is appreciated.
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...