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 | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...