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

proofpoint_tap: improve clarity of agent config and fix pagination logic #11361

Merged
merged 5 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
503 changes: 499 additions & 4 deletions packages/proofpoint_tap/_dev/deploy/docker/files/config.yml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions packages/proofpoint_tap/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# newer versions go on top
- version: "1.24.0"
changes:
- description: Improve clarity of agent behavior configuration.
type: enhancement
link: https://github.com/elastic/integrations/pull/11361
- description: Fix pagination termination condition check.
type: bugfix
link: https://github.com/elastic/integrations/pull/11361
- version: "1.23.0"
changes:
- description: Set default search period to one day.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
input: httpjson
service: proofpoint_tap
vars:
enable_request_tracer: true
url: http://{{Hostname}}:{{Port}}
principal: xxxx
secret: xxxx
data_stream:
vars:
preserve_original_event: true
enable_request_tracer: true
assert:
hit_count: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,53 @@ request.transforms:
value: json
- set:
target: url.params.interval
value: '[[if (le (formatDate ((parseDate .cursor.last_received_time "RFC3339").Add (parseDuration "1h"))) (formatDate (now)))]][[formatDate (parseDate .cursor.last_received_time "RFC3339")]]/[[formatDate ((parseDate .cursor.last_received_time "RFC3339").Add (parseDuration "1h"))]][[else]][[formatDate (parseDate .cursor.last_received_time "RFC3339")]]/[[formatDate now]][[end]]'
default: '[[formatDate (now (parseDuration "-{{initial_interval}}"))]]/[[formatDate ((now (parseDuration "-{{initial_interval}}")).Add (parseDuration "1h"))]]'
value: |-
[[- $last := (parseDate .cursor.last_received_time "RFC3339") -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $last -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $last ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $last ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
default: |-
[[- $start := (now (parseDuration "-{{initial_interval}}")) -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $start -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $start ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $start ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
response.pagination:
- set:
target: url.params.interval
value: '[[if (le (formatDate ((parseDate .last_response.body.queryEndTime "RFC3339").Add (parseDuration "1h"))) (formatDate (now)))]][[formatDate (parseDate .last_response.body.queryEndTime "RFC3339")]]/[[formatDate ((parseDate .last_response.body.queryEndTime "RFC3339").Add (parseDuration "1h"))]][[end]]'
value: |-
[[- if ne (len .last_response.body.clicksBlocked) 0 -]]
[[- $last := (parseDate .last_response.body.queryEndTime "RFC3339") -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $last -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $last ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $last ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
[[- end -]]
fail_on_template_error: true
cursor:
last_received_time:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
input: httpjson
service: proofpoint_tap
vars:
enable_request_tracer: true
url: http://{{Hostname}}:{{Port}}
principal: xxxx
secret: xxxx
data_stream:
vars:
preserve_original_event: true
enable_request_tracer: true
assert:
hit_count: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,53 @@ request.transforms:
value: json
- set:
target: url.params.interval
value: '[[if (le (formatDate ((parseDate .cursor.last_received_time "RFC3339").Add (parseDuration "1h"))) (formatDate (now)))]][[formatDate (parseDate .cursor.last_received_time "RFC3339")]]/[[formatDate ((parseDate .cursor.last_received_time "RFC3339").Add (parseDuration "1h"))]][[else]][[formatDate (parseDate .cursor.last_received_time "RFC3339")]]/[[formatDate now]][[end]]'
default: '[[formatDate (now (parseDuration "-{{initial_interval}}"))]]/[[formatDate ((now (parseDuration "-{{initial_interval}}")).Add (parseDuration "1h"))]]'
value: |-
[[- $last := (parseDate .cursor.last_received_time "RFC3339") -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $last -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $last ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $last ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
default: |-
[[- $start := (now (parseDuration "-{{initial_interval}}")) -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $start -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $start ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $start ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
response.pagination:
- set:
target: url.params.interval
value: '[[if (le (formatDate ((parseDate .last_response.body.queryEndTime "RFC3339").Add (parseDuration "1h"))) (formatDate (now)))]][[formatDate (parseDate .last_response.body.queryEndTime "RFC3339")]]/[[formatDate ((parseDate .last_response.body.queryEndTime "RFC3339").Add (parseDuration "1h"))]][[end]]'
value: |-
[[- if ne (len .last_response.body.clicksPermitted) 0 -]]
[[- $last := (parseDate .last_response.body.queryEndTime "RFC3339") -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $last -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $last ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $last ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
[[- end -]]
fail_on_template_error: true
cursor:
last_received_time:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
input: httpjson
service: proofpoint_tap
vars:
enable_request_tracer: true
url: http://{{Hostname}}:{{Port}}
principal: xxxx
secret: xxxx
data_stream:
vars:
preserve_original_event: true
enable_request_tracer: true
assert:
hit_count: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,53 @@ request.transforms:
value: json
- set:
target: url.params.interval
value: '[[if (le (formatDate ((parseDate .cursor.last_received_time "RFC3339").Add (parseDuration "1h"))) (formatDate (now)))]][[formatDate (parseDate .cursor.last_received_time "RFC3339")]]/[[formatDate ((parseDate .cursor.last_received_time "RFC3339").Add (parseDuration "1h"))]][[else]][[formatDate (parseDate .cursor.last_received_time "RFC3339")]]/[[formatDate now]][[end]]'
default: '[[formatDate (now (parseDuration "-{{initial_interval}}"))]]/[[formatDate ((now (parseDuration "-{{initial_interval}}")).Add (parseDuration "1h"))]]'
value: |-
[[- $last := (parseDate .cursor.last_received_time "RFC3339") -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $last -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $last ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $last ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
default: |-
[[- $start := (now (parseDuration "-{{initial_interval}}")) -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $start -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $start ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $start ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
response.pagination:
- set:
target: url.params.interval
value: '[[if (le (formatDate ((parseDate .last_response.body.queryEndTime "RFC3339").Add (parseDuration "1h"))) (formatDate (now)))]][[formatDate (parseDate .last_response.body.queryEndTime "RFC3339")]]/[[formatDate ((parseDate .last_response.body.queryEndTime "RFC3339").Add (parseDuration "1h"))]][[end]]'
value: |-
[[- if ne (len .last_response.body.messagesBlocked) 0 -]]
[[- $last := (parseDate .last_response.body.queryEndTime "RFC3339") -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $last -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $last ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $last ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
[[- end -]]
fail_on_template_error: true
cursor:
last_received_time:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
input: httpjson
service: proofpoint_tap
vars:
enable_request_tracer: true
url: http://{{Hostname}}:{{Port}}
principal: xxxx
secret: xxxx
data_stream:
vars:
preserve_original_event: true
enable_request_tracer: true
assert:
hit_count: 2
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,53 @@ request.transforms:
value: json
- set:
target: url.params.interval
value: '[[if (le (formatDate ((parseDate .cursor.last_received_time "RFC3339").Add (parseDuration "1h"))) (formatDate (now)))]][[formatDate (parseDate .cursor.last_received_time "RFC3339")]]/[[formatDate ((parseDate .cursor.last_received_time "RFC3339").Add (parseDuration "1h"))]][[else]][[formatDate (parseDate .cursor.last_received_time "RFC3339")]]/[[formatDate now]][[end]]'
default: '[[formatDate (now (parseDuration "-{{initial_interval}}"))]]/[[formatDate ((now (parseDuration "-{{initial_interval}}")).Add (parseDuration "1h"))]]'
value: |-
[[- $last := (parseDate .cursor.last_received_time "RFC3339") -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $last -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $last ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $last ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
default: |-
[[- $start := (now (parseDuration "-{{initial_interval}}")) -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $start -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $start ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $start ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
response.pagination:
- set:
target: url.params.interval
value: '[[if (le (formatDate ((parseDate .last_response.body.queryEndTime "RFC3339").Add (parseDuration "1h"))) (formatDate (now)))]][[formatDate (parseDate .last_response.body.queryEndTime "RFC3339")]]/[[formatDate ((parseDate .last_response.body.queryEndTime "RFC3339").Add (parseDuration "1h"))]][[end]]'
value: |-
[[- if ne (len .last_response.body.messagesDelivered) 0 -]]
[[- $last := (parseDate .last_response.body.queryEndTime "RFC3339") -]]
[[- $hour := (parseDuration "1h") -]]
[[- $end := 0 -]][[- /* Predeclare $end. */ -]]
[[- with $last -]]
[[- $end = .Add $hour -]]
[[- end -]]
[[- with $end -]]
[[- if .Before now -]]
[[- formatDate $last ]]/[[ formatDate $end -]]
[[- else -]]
[[- formatDate $last ]]/[[ formatDate now -]]
[[- end -]]
[[- end -]]
[[- end -]]
fail_on_template_error: true
cursor:
last_received_time:
Expand Down
2 changes: 1 addition & 1 deletion packages/proofpoint_tap/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: "3.0.3"
name: proofpoint_tap
title: Proofpoint TAP
version: "1.23.0"
version: "1.24.0"
description: Collect logs from Proofpoint TAP with Elastic Agent.
type: integration
categories:
Expand Down