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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...