You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, The following is my code:
const logGroup = "xxxxxxx-logs";
const bucketName = "xxxxx-logs"; // replace with your bucket name
const s3Prefix = 'exportedlogs'
const oneDayAgo = new Date('2024-07-26T17:32:20').getTime();
const oneDay = new Date('2024-07-28T20:11:00').getTime();
let params = {
taskName: "export-logs-task",
logGroupName: logGroup,
from: Number(oneDayAgo),
to: Number(oneDay),
destination: bucketName,
destinationPrefix: s3Prefix,
};
try {
const exportLogsClient = new CloudWatchLogsClient({ region: 'us-east-1' });
const command = new CreateExportTaskCommand(params);
const data = await exportLogsClient.send(command);
} catch (error) {
console.error("$$ Error", JSON.stringify(error));
}
When I test the lambda in AWS console. it always throw the InvalidParameterException. The params set correctly and the cloudwatch logs and s3 role policy are correct too.
Error msg:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, The following is my code:
const logGroup = "xxxxxxx-logs";
const bucketName = "xxxxx-logs"; // replace with your bucket name
const s3Prefix = 'exportedlogs'
const oneDayAgo = new Date('2024-07-26T17:32:20').getTime();
const oneDay = new Date('2024-07-28T20:11:00').getTime();
let params = {
taskName: "export-logs-task",
logGroupName: logGroup,
from: Number(oneDayAgo),
to: Number(oneDay),
destination: bucketName,
destinationPrefix: s3Prefix,
};
try {
const exportLogsClient = new CloudWatchLogsClient({ region: 'us-east-1' });
const command = new CreateExportTaskCommand(params);
const data = await exportLogsClient.send(command);
} catch (error) {
console.error("$$ Error", JSON.stringify(error));
}
When I test the lambda in AWS console. it always throw the InvalidParameterException. The params set correctly and the cloudwatch logs and s3 role policy are correct too.
Error msg:
2024-08-13T20:52:04.249Z a2683f0d-a290-46c9-975f-13c2f15b1cd4 ERROR $$ Error
{
"name": "InvalidParameterException",
"$fault": "client",
"$metadata": {
"httpStatusCode": 400,
"requestId": "f5428eb4-0a7e-48c5-a49f-b320647854e0",
"attempts": 1,
"totalRetryDelay": 0
},
"__type": "InvalidParameterException"
}
Need help to know what is the deep reason to cause the InvalidParameterException when we call the CreateExportTaskCommand?
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions