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!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...