Splunk Search

how to read a return value

smolcj
Builder

hi,
if we are using a return command in a subsearch. how can we read the output of the search.
for ex:
if the search is like:
index=newindex source=filename.txt| return $PC_Rename |fields PC_Rename

how can we read the output of this search.PC_Rename consists of only one value , i just want t display the value in it.

please help 😞
thankyou for your time

Tags (1)
0 Karma

Ayn
Legend

Have a look at the format command. It lets you define in which format subsearch results are returned, so you can define a format that is suitable for using with eval for instance if you want to write the value to a variable that you then use for showing somewhere like a SingleValue module.

0 Karma

Ayn
Legend

Yes? What does the number of arguments have to do with it? I don't see how using format would not be the way forward.

0 Karma

smolcj
Builder

Thanks Ayn for your response, but when i look into format command, it needs 6 args, but i just want to read the value returned by my search in a variable and i want to display it in another dashboard or form using that variable. i am stuck with reading the returned value.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...