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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...