Archive

How can I make this nested search faster?

Path Finder

This search works, but it's slow. I know nested searches are no longer recommended. Can anyone help me re-write this search for better performance?

xd_index sourcetype="xendesktop:7:icasession" UserName="" host=""
| eval UserName = lower(UserName)
| join UserName HostedMachineName

[search xd_index sourcetype="xendesktop:7:session" UserName="" host="" ClientAddress=* | eval UserName = lower(UserName)] | stats sparkline(avg(LatencySessionAverage), 1m) as "Latency Trend" by UserName LatencyLastRecorded AgentVersion ClientAddress ClientVersion IPAddress ClientPlatform HostedMachineName BrokeringTime

| lookup COSTCENT RACFID AS UserName OUTPUT RACFName
| fields UserName RACF_Name LatencyLastRecorded "Latency Trend" ClientPlatform ClientVersion ClientAddress IPAddress HostedMachineName BrokeringTime

| sort -LatencyLastRecorded
| dedup HostedMachineName

0 Karma

SplunkTrust
SplunkTrust

Give this a try

`xd_index` sourcetype="xendesktop:7:icasession" UserName="*" host="*" 
[search `xd_index` sourcetype="xendesktop:7:session" UserName="*" host="*" ClientAddress=* | stats count by UserName HostedMachineName| eval UserName = lower(UserName) | table UserName HostedMachineName] 
| eval UserName = lower(UserName)
| join UserName HostedMachineName
| stats sparkline(avg(LatencySessionAverage), 1m) as "Latency Trend" by UserName LatencyLastRecorded AgentVersion ClientAddress ClientVersion IPAddress ClientPlatform HostedMachineName BrokeringTime 
| lookup COSTCENT RACF_ID AS UserName OUTPUT RACF_Name 
| fields UserName RACF_Name LatencyLastRecorded "Latency Trend" ClientPlatform ClientVersion ClientAddress IPAddress HostedMachineName BrokeringTime 
| sort -LatencyLastRecorded 
| dedup HostedMachineName
0 Karma

Super Champion

Possibly something like this. You may need to do an mvexpand after the stats command if you have multiple field values you need split out, or you could have more of those fields after by, I just assumed both sourcetypes didn't have them in common.

(xd_index sourcetype="xendesktop:7:icasession" UserName="" host="" ) OR (xd_index sourcetype="xendesktop:7:session" UserName="" host="" ClientAddress=* )
| eval UserName = lower(UserName)
| stats sparkline(avg(LatencySessionAverage), 1m) as "Latency Trend" values(LatencyLastRecorded) as LatencyLastRecorded values(AgentVersion) as AgentVersion values(ClientAddress) as ClientAddress values(IPAddress) as IPAddress values(ClientVersion) as ClientVersion values(ClientPlatform) as ClientPlatform values(BrokeringTime) as BrokeringTime by UserName HostedMachineName  
| lookup COSTCENT RACF_ID AS UserName OUTPUT RACF_Name 
| fields UserName RACF_Name LatencyLastRecorded "Latency Trend" ClientPlatform ClientVersion ClientAddress IPAddress HostedMachineName BrokeringTime 
| sort -LatencyLastRecorded 
| dedup HostedMachineName
0 Karma

Path Finder

Thank you. that re-write is certainly faster, however now all the data values from the LatencyLastRecorded are in the same event. I am looking at the stats parameters now. If I remove the values() portion, I get no results. Definitely good progress! Thank you!

0 Karma

Super Champion

you might be able to add by sourcetype to the stats command to help break that out?

0 Karma