Splunk Search

last indexed data

rsathish47
Contributor

How to search last indexed data in splunk?

Tags (1)
0 Karma

somesoni2
Revered Legend

Does the data getting indexed have timestamp in it? If yes they are they all same for one import? Do the data have any field/combination of field to uniquely identify each row (to differentiate between different imports).

E.g. suppose data to be imported is CustomerId|CurrentBalance. then
import 1 CUS1|100
import 2 CUS1|110
import 3 CUS1|200

If you have CustomerId as unique field for one import, your can use

your base search | stats first(*) as * by CustomerId

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Splunk offers a few search commands to help fetch the most recent data. Since Splunk always searches backwards in time, the first events found will be the most recent. Look at head, stats first(x), and stats latest(x).

---
If this reply helps you, Karma would be appreciated.
0 Karma

rsathish47
Contributor

hmm ok Thanks for reply

0 Karma

Ayn
Legend

But if you can't define this yourself, you can't expect Splunk to be able to define it either...

0 Karma

rsathish47
Contributor

Am not able to define that.. Thats the reason, I would like to know if any workaround to fetch latest data. without mention date time period

0 Karma

Ayn
Legend

How would you define "latest" as opposed to not latest?

0 Karma

rsathish47
Contributor

Example:
per day two/three times data get captured in splunk. I woluld like search only latest captured data .

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...