Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get processing timeline events #3241

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jbaptperez
Copy link

@jbaptperez jbaptperez commented Dec 5, 2024

IMPORTANT: All Pull Requests should be connected to an issue, if you don't
have an issue, please start by creating an issue and link it to the PR.

Please provide enough information so that others can review your pull request:

  • What existing problem does this PR solve?
    • Impossible to get timeline events when the one is being updated (new Plaso ingestion for the timeline).
  • What new feature is being introduced with this PR?
    • Allows to get timeline events when the timeline is being updated (new Plaso ingestion) i.e. allows to get partial events, already indexed,
    • Adds a setting to enable or disable this feature,
    • The UI clearly communicates to the user that search results against processing timelines may be incomplete and subject to change.
  • Overview of changes to existing functions if required.
    • Backend: In the Sketch model, the active_timelines property includes timelines with a status set to processing,
    • Backend: In the utils.py, the get_validated_indices function includes timelines with a status set to processing,
    • Backend: The POST /sketches/{{sketch_id}}/aggregation/explore/ endpoint includes indices which timeline has a status set to processing.

Checks

  • All tests succeed.
  • Unit tests added.
  • e2e tests added.
  • Documentation updated.

Closing issues

Closes #3219.

Sorry, something went wrong.

@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch 2 times, most recently from 42403d9 to de22d67 Compare December 5, 2024 17:09
@jkppr jkppr added the Backend label Dec 12, 2024
@jkppr
Copy link
Collaborator

jkppr commented Dec 12, 2024

Thanks for adding a draft PR for early feedback. If I see this correctly, you are also having the changes submitted in your PR #3226 in this PR. Can you please separate this out and only commit the changes relevant to the issue #3219 in this PR?

This would make reviewing the code much easier, thanks.

@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch from de22d67 to 281bb34 Compare December 14, 2024 15:09
@jbaptperez
Copy link
Author

@jkppr, I removed the work of the other PR.
I also rebased the branch onto master.

The only change I made for now is at the backend side: It unlocks the desired behaviour: Getting timeline events while in the processing status.
Note for now I did not added any frontend or backend setting to properly toggle this feature, I'll work on it at the end.

At the frontend side, for now, all timeline events appear even if some of them are is in the processing state.
It is easy to reproduce such a situation by forcing a timeline state in the database.
This results in an infinite spinning wheel in the timeline chip.

However, I face difficulties when attempting to change the timeline chip so that a processing one behaves like a ready/failed one, with an additional spinning wheel as the only visual difference.

The complementarity between TimelineChip.vue and TimelineComponent.vue is not trivial.

Do you think someone can help me to accomplish this precise part?

@Annoraaq
Copy link
Collaborator

TimelineComponent.vue contains a slot that is shown if the timeline status is processing. My understanding is that you want to change that and instead want to render the other slot (called "processed" in the code).

Now one thing to be careful about is that TimelineComponent.vue is used by Explore/TimelineChip.vue and Analyzer/TimelineChip.vue and whatever you change in TimelineComponen.vue will impact both types of timeline chips.

@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch 3 times, most recently from 7aad31c to 0177d57 Compare December 23, 2024 17:25
@jbaptperez
Copy link
Author

jbaptperez commented Dec 23, 2024

Hi @jkppr, I have made progress, but still WIP.

For now:

  • I added a user setting (false by default): showProcessingTimelineEvents,
  • I adapted the frontend-ng so that it properly reads the setting,
  • The frontend can display processing timeline events with a consistent TimelineComponent/TimelineChip set,
  • I have manually checked that there is no issue when displaying the timeline chip in the_Analyser results_ and the Visualizations pages.

I am currently developing the following:

  • Updating the backend so that the current hard-coded changes in my branch become variable, depending on a default value as a method parameter or coming from the related endpoint forms (at least GET /sketches/{sketch_id}/ and POST /sketches/{sketch_id}/explore/),
  • Updating the frontend (store.js, RestApiClient.js) so that the setting is properly dispatched over the views.

Feel free to give me advice or instructions to fine tune my change, if necessary.

@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch 2 times, most recently from e5e1caf to 901a0b6 Compare January 8, 2025 14:27
@jbaptperez
Copy link
Author

Hi @jkppr, I just pushed a first version of the feature.

Changes are:

  • POST /sketch/{sketchId}/explore: Add an optional includeProcessingTimelines parameter,
  • sketch model: Update the active_timelines property to include timelines with status processing,
  • POST /sketches/{sketch_id}/aggregation/explore/ : Include indices of timelines with status processing,
  • Add a frontend user setting: showProcessingTimelineEvents,
  • Update the frontend to take into account the showProcessingTimelineEvents,
  • Add a frontend banner when displaying processing timeline events (at least one processing timeline must be selected).

I will try to deploy those changes in my company in order to let the PO check the feature.
However, I would like your opinion about the code I produced, in the meantime.

I'll update the current code in the case we find a bug or the PO wants to change something.
I'll pull out the draft status of the PR when we'll consider it as final.

@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch from 901a0b6 to a3d287e Compare January 9, 2025 09:30
@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch 2 times, most recently from bd02f79 to a308002 Compare January 21, 2025 11:43
@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch from a308002 to 91be24c Compare February 5, 2025 08:42
@jbaptperez jbaptperez closed this Feb 5, 2025
@jbaptperez jbaptperez deleted the get-processing-timeline-events branch February 5, 2025 08:54
@jbaptperez jbaptperez restored the get-processing-timeline-events branch February 5, 2025 08:59
@jbaptperez jbaptperez reopened this Feb 5, 2025
@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch 2 times, most recently from b0b1266 to 2f41b26 Compare February 21, 2025 17:27
@jkppr jkppr self-requested a review February 21, 2025 19:01
Copy link
Collaborator

@jkppr jkppr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature turned out great already during testing, thanks for all the effort!

Here is the first part of a partial review. It covers all files except some files in components/Explore/.

Some general topics I noticed:

  • With the current implementation the decision if the feature will be used is solely on the user. What I'm missing is an option for a server admin to control the functionality. So adding a config option to data/timesketch.conf that allows admins to disable/enable the feature for their instance. Check server side functionality against that setting and handle accordingly. This does not only give the admin of an instance the decision what features they want to support on the deployment but also allows us later to easily add default settings for all users.
    • E.g. SEARCH_PROCESSING_TIMELINES = True
  • There seems to be no processing progress shown anymore on the Data Source dialog, when the feature is turned on. Is this on purpose?

Otherwise I just noticed some errors and added suggestions or questions below.

@@ -438,7 +441,8 @@ export default {
xTitle: this.selectedXTitle,
yTitle: this.selectedYTitle,
},
}
},
include_processing_timelines: !!this.settings.showProcessingTimelineEvents,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change supposed to do? I did not notice any effect on the VisualizationEditor.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It adds the "processing yes/no" boolean for a further backend API call (to propagate the user setting up to the API call).

// least one enabled timeline is the "processing" state.
this.showBanner =
!!this.settings.showProcessingTimelineEvents &&
this.$store.state.sketch.active_timelines
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: you can simplify this by using this.sketch() instead of this.$store.state.sketch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (rebased).

@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch from 2f41b26 to 38a69c9 Compare March 18, 2025 14:05
@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch from 38a69c9 to b8b2507 Compare March 18, 2025 14:40
@jbaptperez
Copy link
Author

@jkppr, @Annoraaq, we (a colleague and I) did the requested changes.
We rebased/squashed the result to minimize the amount of useless commits.
We only put the addition of the new system (backend) setting into a new commit.

The PR is now ready for a final review.

@jbaptperez jbaptperez marked this pull request as ready for review March 18, 2025 14:48
@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch from b8b2507 to e749a4f Compare March 19, 2025 15:26
@jaegeral jaegeral requested a review from jkppr March 19, 2025 15:31
jbaptperez and others added 6 commits March 20, 2025 09:12
The POST /sketches/{sketchId}/explore/ endpoint can now be parameterized
to include processing timeline indices.
Default value is "false" (legacy behaviour).
User settings must be loaded before the sketch to transmit the new
parameter to POST /sketches/{id}/aggregation/explore/.
The setting name is SEARCH_PROCESSING_TIMELINES.
The related user setting (showProcessingTimelineEvents) only appears
when this system setting is enabled.
@jbaptperez jbaptperez force-pushed the get-processing-timeline-events branch from e749a4f to f2c14b6 Compare March 20, 2025 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Seeing data already ingested into a timeline when the related search index is being updated
3 participants