Getting Data In

How to get distinct count of a field only for the latest events?

tmayllart
New Member

I'm constantly feeding my splunk with a .csv source, all of them with a pattern ïn their name: "Data1.csv", "Data2.csv", "Data3.csv", etc...
These csv's have a table like:

_time | Extracted_Host | Info1 | Info2 | Info3

How could I search only for the distinct count of Extracted_host, but only counting based on the latest submitted events? For example: if the latest csv is called Data5.csv, I want my search to get the distinct count of extracted_Host in the Data5.csv, if is Data6.csv, I want my search to get the distinct count of extracted_Host in Data6.csv

0 Karma

KailA
Contributor

Hi,

This is how I would do it:

index=yourindex [search index=yourindex | head 1 | fields source ]
| you  distinct count search here

If your data are order that should work
Let me know 🙂

Kail

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