Repository navigation
Track extraction progress with a persisted watermark. Closes #1637 - #1720
rajsingh1301 wants to merge 4 commits into
Conversation
|
Hey @rajsingh1301 ! I just took a look at your PR. I will need so time to give it a proper review. I think I can do that next week. So you have to be a little patient. |
No worries, take your time! Thanks for the update. Looking forward to your feedback! 😊 |
…ar-Project#1637 Extraction and payload extraction derived their time window from the wall clock, so any downtime lost the windows in between. Each run now continues from the end of the last processed window, capped at INITIAL_EXTRACTION_TIMESPAN. - add ExtractionRun model (per job_name) and ExtractionRunRepository; the latest window_end of a job is its watermark - commit each chunk together with its watermark in one transaction, so a failure on chunk n never repeats chunks before it - retry only RecoverableError (ElasticServerDownError, PayloadServerError); every other failure skips the chunk and records the error - PayloadExtractionJob no longer swallows request errors - cut the extraction window at today's midnight and trigger the daily training once the previous day is fully extracted, instead of relying on the wall clock - ElasticRepository.search() takes a single window; chunking moved to split_time_window() - refresh repository caches after a rolled back chunk - clean up old runs, keeping the latest run of each job
e22720a to
3f51846
Compare
|
Hi @regulartim, just a quick update: I rebased the PR onto the current No rush at all, I know you're busy. Whenever you have time for a review, I'm happy to make changes. And if you'd like me to prepare anything for the T-Pot verification, please let me know. |
regulartim
left a comment
There was a problem hiding this comment.
Hey @rajsingh1301 ! First of all, I am very sorry, that this took so long. But I wanted to take my time to make a proper review and there was a lt going on in the past weeks.
Overall, your work is very solid. Good job. I ran it against a T-Pot and, so far, everything runs smoothly. I'd like to give you access to a T-Pot, such that you can test your code yourself. I contacted you on LinkedIn for that.
If possible, don't force push if you make further changes, so I can review only changes since my last review. Thanks! :)
Hi @regulartim, thank you :) so much for the detailed review and for testing it on a T-Pot, I really appreciate it! |
…L_EXTRACTION_TIMESPAN docs, test day_completed reset
Description
Extraction and payload extraction derived their time window from the wall clock, so any downtime lost the windows in between. Each run now continues from where the last one stopped, capped at
INITIAL_EXTRACTION_TIMESPAN.What changed:
ExtractionRunmodel (indexedjob_name, window, status,ioc_count,last_error, timestamps), read-only in the admin. The latestwindow_endof a job is its watermark. BothExtractionJobandPayloadExtractionJobuse it.CleanUpdeletes old runs afterEXTRACTION_RUN_RETENTIONdays (default 30) but always keeps the latest run of each job.RecoverableErroris retried (ElasticServerDownErrorand the newPayloadServerErrorinherit from it). Any other failure skips the chunk and records the error. A lost Elasticsearch connection during the scan now also counts asElasticServerDownError.PayloadExtractionJobno longer swallows request errors, so an outage of the payload server is retried. A malformed response is skipped and recorded.dbefore the daily training. The training is triggered once the extraction has reached midnight, instead of by checking the wall clock.TrainModelsis unchanged.ElasticRepository.search()now takes a single window. The chunking moved tosplit_time_window().create_honeypotand the bucket upsert keeps a chunk transaction usable when those fail on their own. After a rolled back chunk, the IOC and sensor caches are reloaded.Points for review:
interaction_count. Because of this,_minutes_back_to_lookupis replaced by_extraction_windowbut not by a pure "watermark orINITIAL_EXTRACTION_TIMESPAN" rule.Related issues
Closes #1637
Type of change
Checklist
Formalities
<feature name>. Closes #999develop.develop.Docs and tests
Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.GUI changes
Ignore this section if you did not make any changes to the GUI.