Splunk Search

How to sum of distinct count of different fields?

pinpra
New Member

I need to sum of distinct count(emal_id) if event_name=email and distinct_count(person_id) if event_name=push. And sum of these distinct count need to be in one field.

Please suggest.

Any help would be highly appreciated.

0 Karma

sbbadri
Motivator

| eval dc_email_id=if(event_name=="email",somefield1,0)
| eval dc_persion_id=if(event_name="push",somefield2,0)
| stats dc(dc_email_id) as emailID,dc(dc_person_id) as personID by event_name| eval somefield_name = emailID + personID

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 ...