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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...