Splunk Search

how can pass a date to search index to pull the incremental data

nikilkatturi
New Member

i am trying to pull the data from splunk index using python and it triggers every 5 min. So i need to fetch the new data for the every run , nothing but an incremental data pull.

Tags (1)
0 Karma
1 Solution

solarboyz1
Builder

Splunk does not keep anything like a record number, to allow you to track the last record pulled and continue from there.
Since events can arrive well after the were generated, using the events time as the filter will cause you to miss events received late.

Start=$End_Previous_Run$+1
End=now()-5m

Then using those timeframes in your splunk search:
index=* criteria _index_earliest=$Start _index_latest=$End

Doing this should simulate a incremental pull of the data.

The format of the date sent can be in epoch time, which I recommend:
https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/SearchTimeModifiers

View solution in original post

0 Karma

solarboyz1
Builder

Splunk does not keep anything like a record number, to allow you to track the last record pulled and continue from there.
Since events can arrive well after the were generated, using the events time as the filter will cause you to miss events received late.

Start=$End_Previous_Run$+1
End=now()-5m

Then using those timeframes in your splunk search:
index=* criteria _index_earliest=$Start _index_latest=$End

Doing this should simulate a incremental pull of the data.

The format of the date sent can be in epoch time, which I recommend:
https://docs.splunk.com/Documentation/Splunk/7.2.6/SearchReference/SearchTimeModifiers

0 Karma

nikilkatturi
New Member

Thanks for the answer. In what format should i pass the date ?

0 Karma

solarboyz1
Builder

I would use Epoch or Unix time:
https://en.wikipedia.org/wiki/Unix_time

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...