Skip to content

Commit 41df541

Browse files
author
Alekhya Parisha
committed
Add lookback time adjustment for Office 365 source plugin partition execution
Signed-off-by: Alekhya Parisha <aparisha@amazon.com>
1 parent 8904048 commit 41df541

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • data-prepper-plugins/saas-source-plugins/microsoft-office365-source/src/main/java/org/opensearch/dataprepper/plugins/source/microsoft_office365/service

data-prepper-plugins/saas-source-plugins/microsoft-office365-source/src/main/java/org/opensearch/dataprepper/plugins/source/microsoft_office365/service/Office365Service.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ public AuditLogsResponse searchAuditLogs(final String logType,
6363
return office365RestClient.searchAuditLogs(logType, startTime, endTime, nextPageUri);
6464
}
6565

66-
// Check and adjust start time for 7-day limit
66+
// Adjust start time based on configured lookback hours
6767
Instant adjustedStartTime = startTime;
68-
Instant sevenDaysAgo = Instant.now().minus(SEVEN_DAYS);
69-
if (startTime.isBefore(sevenDaysAgo)) {
70-
adjustedStartTime = sevenDaysAgo;
68+
Instant lookBackHoursAgo = Instant.now().minus(Duration.ofHours(office365SourceConfig.getLookBackHours()));
69+
if (startTime.isBefore(lookBackHoursAgo) && lookBackHoursAgo.isBefore(endTime)) {
70+
adjustedStartTime = lookBackHoursAgo;
7171
}
7272

7373
AuditLogsResponse response =

0 commit comments

Comments
 (0)