-
Notifications
You must be signed in to change notification settings - Fork 522
[Exchange Online Message Trace] Add Additional Look-back Time & Fix Cursor Value #8717
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
Conversation
packages/microsoft_exchange_online_message_trace/data_stream/log/agent/stream/httpjson.yml.hbs
Show resolved
Hide resolved
packages/microsoft_exchange_online_message_trace/data_stream/log/agent/stream/httpjson.yml.hbs
Outdated
Show resolved
Hide resolved
|
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
This reverts commit f804e26.
|
I've updated the PR to include the ability to configure an additional look-back time. I chose I've updated the docs to include a mention this new field and the potential for missing events. Unfortunately, Microsoft doesn't seem to offer a way to sort by a similar field like I've updated the main PR description with screenshots showing the difference between current and this PR. I took the "wording" for this new field mainly from Kibana's Security Rules "Additional Look-back time" field. |
|
/test |
packages/microsoft_exchange_online_message_trace/docs/README.md
Outdated
Show resolved
Hide resolved
packages/microsoft_exchange_online_message_trace/_dev/build/docs/README.md
Outdated
Show resolved
Hide resolved
packages/microsoft_exchange_online_message_trace/_dev/build/docs/README.md
Outdated
Show resolved
Hide resolved
🚀 Benchmarks reportTo see the full report comment with |
🌐 Coverage report
|
|
@BenB196 The change looks pretty good so far barring a few documentation issues, it would be awesome if you could add some system tests to simulate this updated behaviour of the integration. |
Co-authored-by: ShourieG <[email protected]>
|
@ShourieG, docs changes applied, regarding the system tests. I'm a bit stuck here. I'd like to have a system test which queries the test endpoint, and asserts Would you happen to know of a similar system test example or point to the docs which highlight how to implement a multi-run system test? |
|
@BenB196 You can have 2 system test configs, one for the 2 doc case and one for the 3 doc case. |
Hi @efd6 thanks for the reply. Question, will both tests then use the same Elastic Agent state? The reason I ask is I'd like the system test if possible to follow a flow like:
This test would allow for covering both the |
|
No, they would be separate tests. You would need to engineer the 2 and then 1 behaviour in the 3 event test. The 2 event test case would test the initial 2 events in the 3 event case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This comment is partially outdated, see: #8717 (comment))
I've expanded on the system tests here a bit.
There is still an issue with this though that I'll need to take a look at tomorrow, but pushing in the event someone else wants to take a look.
The current issue is that the cursor
cursor:
last_execution_datetime:
value: '[[ toJSON .last_event.message "EndDate" ]]'Can become null/empty, in the event that the .last_response is empty, more specifically, you get value: [] (which it can be), and defaults back to now. I'm not sure the best way to handle this issue currently.
A few options I see:
- Default to
now.- This is the easiest, but has the disadvantage of bringing back some of the issues this PR initially tried to solve.
- Find a way to parse the
$filterparam to try and get the EndDate value from it.- This would provide the current value, but I don't see a way to easily parse this param to get the value within the httpjson templating.
- Open to ideas/suggestions that people might have.
...soft_exchange_online_message_trace/data_stream/log/_dev/test/system/test-httpjson-config.yml
Outdated
Show resolved
Hide resolved
packages/microsoft_exchange_online_message_trace/data_stream/log/agent/stream/httpjson.yml.hbs
Show resolved
Hide resolved
...soft_exchange_online_message_trace/data_stream/log/elasticsearch/ingest_pipeline/default.yml
Outdated
Show resolved
Hide resolved
packages/microsoft_exchange_online_message_trace/_dev/deploy/docker/files/config.yml
Outdated
Show resolved
Hide resolved
|
/test |
...online_message_trace/data_stream/log/_dev/test/system/test-httpjson-null-trailing-config.yml
Show resolved
Hide resolved
packages/microsoft_exchange_online_message_trace/data_stream/log/agent/stream/httpjson.yml.hbs
Show resolved
Hide resolved
...soft_exchange_online_message_trace/data_stream/log/elasticsearch/ingest_pipeline/default.yml
Outdated
Show resolved
Hide resolved
|
/test |
Co-authored-by: Dan Kortschak <[email protected]>
packages/microsoft_exchange_online_message_trace/data_stream/log/agent/stream/httpjson.yml.hbs
Outdated
Show resolved
Hide resolved
…og/agent/stream/httpjson.yml.hbs Co-authored-by: Dan Kortschak <[email protected]>
|
/test |
efd6
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but waiting for @ShourieG.
ShourieG
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Package microsoft_exchange_online_message_trace - 1.18.0 containing this change is available at https://epr.elastic.co/search?package=microsoft_exchange_online_message_trace |
1 similar comment
|
Package microsoft_exchange_online_message_trace - 1.18.0 containing this change is available at https://epr.elastic.co/search?package=microsoft_exchange_online_message_trace |
* upstream/main: (117 commits) [TI MISP] Add IOC expiration support (#8639) Add CSPM Rules 6.2, 6.3 and 6.4 (#8778) [Infoblox NIOS] Update timestamp parsing logic (#8767) [Rapid7 InsightVM] Split vulnerability categories into array (#8768) [Exchange Online Message Trace] Add Additional Look-back Time & Fix Cursor Value (#8717) [Buildkite] Update bucket settings (#8765) Remove Jenkins .ci folder (#8766) First part of removal of Jenkins jobs (#8763) misp: parse URIs for URI type threats (#8760) [amazon_security_lake] Added support for all the OCSF Classes (#8579) [Buildkite] Update settings for integrations pipeline (#8758) [TI ThreatQ] Add IOC expiration support (#8691) [ti_opencti] Support OpenCTI 5.12 by removing filters parameter (#8744) [Cribl] Updating setup guidance for Cribl field (#8746) crowdstrike: add userinfo enrichment support and map fields to ECS (#8742) [etcd] Enable TSDB for metrics datastream (#8649) Bump golang.org/x/crypto from 0.16.0 to 0.17.0 (#8749) auditd: relax field_split pattern and handle AVC header (#8748) Update cloud packages codeowner (#8672) [O11Y] [AWS Billing] Convert "Total Estimated Charges" visualization to new metric (#8509) ...
* upstream/main: (117 commits) [TI MISP] Add IOC expiration support (#8639) Add CSPM Rules 6.2, 6.3 and 6.4 (#8778) [Infoblox NIOS] Update timestamp parsing logic (#8767) [Rapid7 InsightVM] Split vulnerability categories into array (#8768) [Exchange Online Message Trace] Add Additional Look-back Time & Fix Cursor Value (#8717) [Buildkite] Update bucket settings (#8765) Remove Jenkins .ci folder (#8766) First part of removal of Jenkins jobs (#8763) misp: parse URIs for URI type threats (#8760) [amazon_security_lake] Added support for all the OCSF Classes (#8579) [Buildkite] Update settings for integrations pipeline (#8758) [TI ThreatQ] Add IOC expiration support (#8691) [ti_opencti] Support OpenCTI 5.12 by removing filters parameter (#8744) [Cribl] Updating setup guidance for Cribl field (#8746) crowdstrike: add userinfo enrichment support and map fields to ECS (#8742) [etcd] Enable TSDB for metrics datastream (#8649) Bump golang.org/x/crypto from 0.16.0 to 0.17.0 (#8749) auditd: relax field_split pattern and handle AVC header (#8748) Update cloud packages codeowner (#8672) [O11Y] [AWS Billing] Convert "Total Estimated Charges" visualization to new metric (#8509) ...
* upstream/main: (117 commits) [TI MISP] Add IOC expiration support (#8639) Add CSPM Rules 6.2, 6.3 and 6.4 (#8778) [Infoblox NIOS] Update timestamp parsing logic (#8767) [Rapid7 InsightVM] Split vulnerability categories into array (#8768) [Exchange Online Message Trace] Add Additional Look-back Time & Fix Cursor Value (#8717) [Buildkite] Update bucket settings (#8765) Remove Jenkins .ci folder (#8766) First part of removal of Jenkins jobs (#8763) misp: parse URIs for URI type threats (#8760) [amazon_security_lake] Added support for all the OCSF Classes (#8579) [Buildkite] Update settings for integrations pipeline (#8758) [TI ThreatQ] Add IOC expiration support (#8691) [ti_opencti] Support OpenCTI 5.12 by removing filters parameter (#8744) [Cribl] Updating setup guidance for Cribl field (#8746) crowdstrike: add userinfo enrichment support and map fields to ECS (#8742) [etcd] Enable TSDB for metrics datastream (#8649) Bump golang.org/x/crypto from 0.16.0 to 0.17.0 (#8749) auditd: relax field_split pattern and handle AVC header (#8748) Update cloud packages codeowner (#8672) [O11Y] [AWS Billing] Convert "Total Estimated Charges" visualization to new metric (#8509) ...
Enhancement & Bug
Proposed commit message
This PR makes two changes to the Exchange Online Message Trace integration:
1. Performs a refactor ofhttpjson.yml.hbsfile to move therequest.*&response.*parts together, or inversely moving all the fields/tags stuff towards the end of the file. (making it easier to follow from my perspective)last_execution_datetimecursor was being set.now, the issue with this is that the cursor sets it value once "all events ... are published". This meant that if a cycle took five minutes to complete, there could be a five minute gap in time/data between the last iteration'sEndDateand the next iteration'sStartDate. This appears to have always been an "issue" but became more noticeable with [integrations][Exchange Online Message Trace] - Refactored the integration and reworked the documentation #8550 where it changed the default interval from1mto1h, making it take far longer to process an iteration and making the gap in data more noticable.To "fix" this issue, rather than usingnow, we take the.last_event.EndDateas the value. This should ensure that the next iteration always starts where the last one ended.Side Note: This also fixes another issue, for if Microsoft ever has an issue publishing Message Traces. Before this change, the integration would continue on as if there was no problem and leave a potentially large gap in data. Now the integration will hold at the last published event and pick up once Microsoft fixes the event publishing.Checklist
changelog.ymlfile.Author's Checklist
elastic-package.exe testand the tests passed, however, I'm honestly not too familiar with the httpjson input. Would someone be able to take a look and confirm that this does indeed look correct, or if there is any additional testing that can be done? Looking at how some of the other cursors do it; https://github.com/search?q=repo%3Aelastic%2Fintegrations+%22cursor%3A%22&type=code this does appear to be "correct".last_execution_datetimeever gets too far out of date (older than Microsoft's Message Trace retention duration - 90 days), then the integration would be "stuck" in this state until recreated. This seems like it would be a similar issue with a number of other integrations, so I opted not to try and solve it here as I'm not sure how "real" of a "bug" this actually is.How to test this PR locally
elastic-package.exe testand everything passed.Related issues
Screenshots
(Interval for the screenshots set to
5mfor easier visibility into the change)Current/
main/1.17.x:This PR: