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

[Filebeat] Add Initial Interval for Microsoft Filesets #42309

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ otherwise no tag is added. {issue}42208[42208] {pull}42403[42403]
- Add metrics for number of events and pages published by HTTPJSON input. {issue}42340[42340] {pull}42442[42442]
- Add `etw` input fallback to attach an already existing session. {pull}42847[42847]
- Update CEL mito extensions to v1.17.0. {pull}42851[42851]
- Add Initial Interval for Microsoft Filesets (ATP, Defender) {pull}42309[42309]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Add Initial Interval for Microsoft Filesets (ATP, Defender) {pull}42309[42309]
- Add Initial Interval for Microsoft Filesets (ATP, Defender). {pull}42309[42309]


*Auditbeat*

Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/awss3/sqs_s3_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (r sqsProcessingResult) Done() {
return
}
p.metrics.sqsMessagesDeletedTotal.Inc()
p.log.Errorf("failed processing SQS message (message was deleted): %w", processingErr)
p.log.Errorf("failed processing SQS message (message was deleted): %v", processingErr.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
p.log.Errorf("failed processing SQS message (message was deleted): %v", processingErr.Error())
p.log.Errorf("failed processing SQS message (message was deleted): %v", processingErr)

I'm not sure about having this in this PR since it's an unrelated change. See what other reviewers say.

Copy link
Author

Choose a reason for hiding this comment

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

I can remove this if its an issue. also processingErr.Error() is used in line 253 for the same object.

return
}

Expand Down
8 changes: 8 additions & 0 deletions x-pack/filebeat/module/microsoft/_meta/docs.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ A predefined URL towards the Oauth2 service for Microsoft. The URL should always

A list of included scopes, should use .default unless different is specified.

*`var.initial_interval`*::

An initial interval can be defined. The first time the module starts, will fetch events from the current moment minus the initial interval value. Following restarts will fetch events starting from the last event read. It defaults to `55m`.

[float]
==== 365 Defender ECS fields

Expand Down Expand Up @@ -153,6 +157,10 @@ The secret related to the client ID.

A predefined URL towards the Oauth2 service for Microsoft. The URL should always be the same with the exception of the Tenant ID that needs to be added to the full URL.

*`var.initial_interval`*::

An initial interval can be defined. The first time the module starts, will fetch events from the current moment minus the initial interval value. Following restarts will fetch events starting from the last event read. It defaults to `5m`.

[float]
==== Defender ATP ECS fields

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ request.transforms:
- set:
target: "url.params.$filter"
value: 'lastUpdateTime gt [[formatDate .cursor.lastUpdateTime "2006-01-02T15:04:05.9999999Z"]]'
default: 'lastUpdateTime gt [[formatDate (now (parseDuration "-5m")) "2006-01-02T15:04:05.9999999Z"]]'
default: 'lastUpdateTime gt [[formatDate (now (parseDuration "-{{.initial_interval}}")) "2006-01-02T15:04:05.9999999Z"]]'

response.split:
target: body.value
Expand Down
2 changes: 2 additions & 0 deletions x-pack/filebeat/module/microsoft/defender_atp/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var:
default: [defender-atp, forwarded]
- name: oauth2
- name: proxy_url
- name: initial_interval
default: 5m

ingest_pipeline: ingest/pipeline.yml
input: config/atp.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ request.transforms:
- set:
target: "url.params.$filter"
value: 'lastUpdateTime gt [[.cursor.lastUpdateTime]]'
default: 'lastUpdateTime gt [[formatDate (now (parseDuration "-55m")) "2006-01-02T15:04:05.9999999Z"]]'
default: 'lastUpdateTime gt [[formatDate (now (parseDuration "-{{.initial_interval}}")) "2006-01-02T15:04:05.9999999Z"]]'
response.split:
target: body.value
ignore_empty_value: true
Expand Down
2 changes: 2 additions & 0 deletions x-pack/filebeat/module/microsoft/m365_defender/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var:
default: [m365-defender, forwarded]
- name: oauth2
- name: proxy_url
- name: initial_interval
default: 55m

ingest_pipeline: ingest/pipeline.yml
input: config/defender.yml
Expand Down
Loading