Splunk Search

Compare the result of two searches

StianDanielsen
New Member

I am trying to compare users logged in by device vs users logged in via html site.

For device, the query is something like:
index="prodenv" host="Somehost" Mobile.aspx s_port="443" cs_username!="-" | stats count

For html, the query is something like:
index="prodenv" cs_method="POST" cs_uri_stem="/data/commands.svc/login" sc_status="200" | stats count

I tried to combine these two with something like the following:
index="prodenv" host="Somehost" | eval mobile=Mobile.aspx s_port="443" cs_username!="-" | eval html=cs_method="POST" cs_uri_stem="/data/commands.svc/login" sc_status="200" | stats (make a pie showing mobile vs html)

...which of course didn't work.

How can I combine these two in order to achieve my desired result?

Tags (1)
0 Karma

Damien_Dallimor
Ultra Champion

You could create an event type for each type of logon (device_logon & web_server_logon) , and then simply perform a search such as :

index=prodenv | stats count by eventtype

Your 2 event type searches would be :

device_logon event type

host="Somehost" Mobile.aspx s_port="443" cs_username!="-"

web_server_logon event type

cs_method="POST" cs_uri_stem="/data/commands.svc/login" sc_status="200"

Damien_Dallimor
Ultra Champion

1) if you are using Splunk 5.0, you can try Search accleration
2) you could use a saved scheduled search it, and then when the dashboard loads, it will load the results from the last time the search executed
3) you could use summary indexing

0 Karma

StianDanielsen
New Member

Thank you, Damien.

I tried it out, but it was running very slow. The search is for all of yesterday and the first part (index=prodenv) has a lot of data to go through.

Any other suggestions?

0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...