Splunk Search

Unique row number in while indexing

himanshusinha1
Explorer

Hi All,
Is there any possibility to create a unique index number while indexing because i want to search the result on behalf of last event id i read.then i will read the event greater then from that last event id.
The problem i faced is device is generating wrong date time and that time is future date time in that case our earliest and latest logic is failing. because i was storing the _time value as a last trigger date and that was future date.so i want to create a unique auto incremented row number id while indexing.
Please help!!

Tags (1)
0 Karma
1 Solution

Ayn
Legend

You could use _indextime instead of _time. If that's not enough you could also use (or combine) the _cd field for uniqueness. Both are a kind of incrementing counters.

View solution in original post

0 Karma

Ayn
Legend

_cd is a unique number within an index (it consists of a bucket number and an offset within that bucket). It always exists. It does not increment just by 1 though, the only guarantee you have is that it's incrementing.

Not sure what you mean by that it's taking a long time to search and why.

0 Karma

himanshusinha1
Explorer

Thanks.. can we get _cd in every type of device logs?
Can we get the two ranges of _cd logs e.g i got 1234 in _cd now i want the logs between 1234 and 1240 o/p = 6 events?
_indextime is returning epoch time and its taking long time i search.

0 Karma

Ayn
Legend

You could use _indextime instead of _time. If that's not enough you could also use (or combine) the _cd field for uniqueness. Both are a kind of incrementing counters.

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...