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

[ti_misp] Keep the same timestamp for later pages #6649

Merged
merged 4 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/ti_misp/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.16.1"
changes:
- description: Keep the same timestamp for later pages in a pagination sequence.
type: bugfix
link: https://github.com/elastic/integrations/pull/6649
- version: "1.16.0"
changes:
- description: Ensure event.kind is correctly set for pipeline errors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ request.transforms:
target: body.timestamp
value: '[[.cursor.timestamp.Unix]]'
default: '[[ (now (parseDuration "-{{initial_interval}}")).Unix ]]'
- set:
chrisberkhout marked this conversation as resolved.
Show resolved Hide resolved
# Ignored by MISP, set as a workaround to make it available in response.pagination.
target: url.params.timestamp
value: '[[.body.timestamp]]'

response.split:
target: body.response
Expand All @@ -59,6 +63,12 @@ response.pagination:
# Add 2 because the httpjson page counter is zero-based while the MISP page parameter starts at 1.
value: '[[if (ne (len .last_response.body.response) 0)]][[add .last_response.page 2]][[end]]'
fail_on_template_error: true
- set:
target: body.timestamp
value: '[[.last_response.url.params.Get "timestamp"]]'
- set:
target: url.params.timestamp
value: '[[.last_response.url.params.Get "timestamp"]]'
cursor:
timestamp:
value: '[[.last_event.Event.timestamp]]'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ request.transforms:
target: body.timestamp
value: '[[.cursor.timestamp.Unix]]'
default: '[[ (now (parseDuration "-{{initial_interval}}")).Unix ]]'
- set:
# Ignored by MISP, set as a workaround to make it available in response.pagination.
target: url.params.timestamp
value: '[[.body.timestamp]]'

response.split:
target: body.response.Attribute
Expand All @@ -51,6 +55,12 @@ response.pagination:
# Add 2 because the httpjson page counter is zero-based while the MISP page parameter starts at 1.
value: '[[if (ne (len .last_response.body.response.Attribute) 0)]][[add .last_response.page 2]][[end]]'
fail_on_template_error: true
- set:
target: body.timestamp
value: '[[.last_response.url.params.Get "timestamp"]]'
- set:
target: url.params.timestamp
value: '[[.last_response.url.params.Get "timestamp"]]'
cursor:
timestamp:
value: '[[.last_event.Attribute.timestamp]]'
Expand Down
2 changes: 1 addition & 1 deletion packages/ti_misp/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ti_misp
title: MISP
version: "1.16.0"
version: "1.16.1"
release: ga
description: Ingest threat intelligence indicators from MISP platform with Elastic Agent.
type: integration
Expand Down