Splunk Search

I need a single value after dividing 2 results which we obtain as a result of stats dc. As of now, I see 3 values.

prateedshetty
Path Finder

The query I use is-

sourcetype=iis URL_root=abc "https://www.abc.com"|stats dc(SessionId) as TotalVisits, dc(userid) as TotalUsers|eval AvgVisit=TotalVisits/TotalUsers

So the final result I see has 1 row but with 3 values-one each for TotalVisits, Totalusers and AvgVisit. But in the dashboard all I need is the AvgVisit value. This is to calculate the average visit per visitor value. Using the single Value panel in the dashboard displays the first value i.e TotalVisits. Please help!

0 Karma
1 Solution

somesoni2
Revered Legend

You just need to add a table command at the end of your search to list the fields that you want to display (and in which order).

sourcetype=iis URL_root=abc "https://www.abc.com"|stats dc(SessionId) as TotalVisits, dc(userid) as TotalUsers|eval AvgVisit=TotalVisits/TotalUsers | table AvgVisit

View solution in original post

0 Karma

somesoni2
Revered Legend

You just need to add a table command at the end of your search to list the fields that you want to display (and in which order).

sourcetype=iis URL_root=abc "https://www.abc.com"|stats dc(SessionId) as TotalVisits, dc(userid) as TotalUsers|eval AvgVisit=TotalVisits/TotalUsers | table AvgVisit
0 Karma

prateedshetty
Path Finder

Thanks! It worked as I wanted it to.. 🙂

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...