Skip to content

GenerateAccessLogsCommand from '@aws-sdk/client-amplify' dates range #6462

@teresarg

Description

@teresarg

Checkboxes for prior research

Describe the bug

I am using GenerateAccessLogsCommand to get the access logs from my amplify app for a specific time.

When calling GenerateAccessLogsCommand, if, for example, I send as start date: 2024-09-11T14:12:21.237Z and as end date: 2024-09-11T15:12:21.237Z, I get some logs out of this range of dates. In this case, I am getting logs from 14:22 until 15:39.

This looks a bit random, cause sometimes I also miss some logs from the date ranges, and other times I get logs previous to the dates range I send.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v16.20.2

Reproduction Steps

const client = new AmplifyClient({ region: "[region]" });

const currentTime = new Date();
    
// Example for getting logs from 1.5 hours before. Range of one hour
const endTime = new Date(currentTime.getTime() - 30 * 60 * 1000);
const startTime = new Date(endTime.getTime() - 60 * 60 * 1000);

const input = {
    startTime: startTime,
    endTime: endTime,
    domainName: "[domain]",
    appId: "[amplifyApp]",
};

const command = new GenerateAccessLogsCommand(input);
const response = await client.send(command);

const logsResponse = await fetch(response.logUrl || '');
const logs = await logsResponse.text();

Observed Behavior

Getting logs out of the range

Expected Behavior

Get all logs includes in the range of dates I send to GenerateAccessLogsCommand

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueservice-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions