Splunk Search

How to replace join command with any other alternative command for the below query?

pstalin_
Engager

index=105261-cli sourcetype=show_processes_cpu pid=0
| dedup deviceId
| fields deviceId, idle, fiveMinutes
| eval cpuLoad = round(if(isnull(fiveMinutes), 100-idle, fiveMinutes))
| join deviceId
[ search index=105261-np sourcetype=device_details
| fields deviceId, deviceName, productFamily, swVersion ]
| eval Status=if((cpuLoad <85 ), "OK" , "Not OK" )
| table deviceName, productFamily, cpuLoad, swVersion, Status
| sort - cpuLoad

Labels (1)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

@pstalin_ 

This query might do the trick. I believe your dedup will in practice get the most recent event from the cli index for that device, hence the use of latest(*)

(index=105261-cli sourcetype=show_processes_cpu pid=0) OR (index=105261-np sourcetype=device_details)
| fields deviceId, idle, fiveMinutes deviceId, deviceName, productFamily, swVersion
| stats latest(*) as * by deviceId
| eval cpuLoad = round(if(isnull(fiveMinutes), 100-idle, fiveMinutes))
| eval Status=if((cpuLoad <85 ), "OK" , "Not OK" )
| table deviceName, productFamily, cpuLoad, swVersion, Status
| sort - cpuLoad

but this

  • making the two combined searches
  • limiting fields to those needed from either search
  • using stats to 'join' the two data sets with latest(*) as * to handle all fields
  • then doing your post search calcs

Hope this helps.

 

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 ...