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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...