Splunk Search

How to sum same field twice

TylerJVitale
Explorer

I want to be able to sum the same field in order to create 2 different fields so that I can compare the Volume by application to the total volume. Right now this is the structure of my search:

| stats sum(VOLUME) as VOLUME, count(USERNAME_O) as AFFECTED_USERS by APPLICATION | 
join [ search |  stats sum(VOLUME) as TOTAL_VOLUME | where TOTAL_VOLUME > 1 |  head 1 ]

Is there a more efficient way I can do this so that I don't have to use the "join" part and go through the whole index twice?

0 Karma
1 Solution

jnudell_2
Builder

Hi @TylerJVitale ,

This sounds like a good place to use eventstats.

| stats sum(VOLUME) as VOLUME, count(USERNAME_O) as AFFECTED_USERS by APPLICATION
| eventstats sum(VOLUME) as TOTAL_VOLUME

View solution in original post

0 Karma

jnudell_2
Builder

Hi @TylerJVitale ,

This sounds like a good place to use eventstats.

| stats sum(VOLUME) as VOLUME, count(USERNAME_O) as AFFECTED_USERS by APPLICATION
| eventstats sum(VOLUME) as TOTAL_VOLUME
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 ...