Splunk Search

Display the timestamp from both the main search AND the subsearch (multiple-fields)

pkeller
Contributor

Trying to add some additional information in the output of an event correlation

index=compute source="*messages" "DOWN" AND [search index=storage source="*messages" ERROR_STRING | rename _time as Storage_Event_Time | rename Client AS host| fields host, Storage_Event_Time ] | table Storage_Event_TIme,_time,host

This correlation works fine WITHOUT trying to add the Storage_Event_Time field to the 'fields' portion of the subsearch ... ( I get the blue bar saying "no matching fields exist" ) ...

I can even run the entire search without error if I just remove "Storage_Event_Time from the 'table' command ... I'm inclined to believe that I can only pass a single field ( and a common one at that ) out of the subsearch ...

Apologies if this is not clear.

0 Karma
1 Solution

sowings
Splunk Employee
Splunk Employee

The subsearch in your current syntax is returning rows to act as an event filter to your outer search.

If you click the job inspector (the white-on-blue 'i' on the right), you'll see a blob that says "subsearch evaluated to", and it'll be something like "( (host="<host1> AND Storage_Event_Time=time_1) OR (host="<host2" AND Storage_Event_Time=time_2) )". If the field "Storage_Event_Time" doesn't exist in the compute index, you won't return any results.

Perhaps you want to append?

View solution in original post

0 Karma

sowings
Splunk Employee
Splunk Employee

The subsearch in your current syntax is returning rows to act as an event filter to your outer search.

If you click the job inspector (the white-on-blue 'i' on the right), you'll see a blob that says "subsearch evaluated to", and it'll be something like "( (host="<host1> AND Storage_Event_Time=time_1) OR (host="<host2" AND Storage_Event_Time=time_2) )". If the field "Storage_Event_Time" doesn't exist in the compute index, you won't return any results.

Perhaps you want to append?

0 Karma

sowings
Splunk Employee
Splunk Employee

Ah, I see. Append is just that, take this second set, add it to (the "bottom") of the first set. It sounds instead like you might want to be doing join on the two, using host as the common column.

0 Karma

pkeller
Contributor

Thank you ... Your answer makes complete sense ... I'm working on getting this to work using append, but still having issues getting the search in the append section to associate with the prior search ... So, in essence, I get results that do not fold in the results from the append ... ie: half the results are from the first part of the search and the other half are from the append ... but they're not matching on the 'host' field ...

It probably sounds wonky .. .I know ... I'll keep thunking away.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...