Open covertbert opened 1 year ago
Hey @covertbert, thanks for opening this issue, however I am not able to reproduce your issue. Are there any more specifics from your use case that may affect the response? I used the code like this which returns the right data on the similar version of @aws-sdk/client-cloudwatch-logs
import { CloudWatchLogsClient, DescribeLogGroupsCommand } from "@aws-sdk/client-cloudwatch-logs";
(async() => {
try {
const client = new CloudWatchLogsClient({});
const params = {
logGroupNamePattern: "something-that-matches", //tried to play with different values too
};
const command = new DescribeLogGroupsCommand(params);
const response = await client.send(command);
console.log(response);
} catch (error) {
console.log(error);
}
})();
Not sure what else to say other than your code doesn't work for me.
I copied your code exactly and just tweaked the pattern string (and change params
to parameters
to satisfy our eslint
):
import {
CloudWatchLogsClient,
DescribeLogGroupsCommand,
} from '@aws-sdk/client-cloudwatch-logs'
const client = new CloudWatchLogsClient({})
const parameters = {
logGroupNamePattern: '-ephemeral-',
}
const command = new DescribeLogGroupsCommand(parameters)
const { logGroups } = await client.send(command)
logGroups?.forEach(group => {
console.log(group.logGroupName)
})
This code is running in a lambda and the lambda output is this:
2023-09-27T14:45:27.169Z d5dbd88a-2172-4359-b835-73c799932818 INFO /aws/lambda/diego-oat-direct
2023-09-27T14:45:27.169Z d5dbd88a-2172-4359-b835-73c799932818 INFO /aws/lambda/diego-oat-event
2023-09-27T14:45:27.169Z d5dbd88a-2172-4359-b835-73c799932818 INFO /aws/lambda/diego-sit-api
2023-09-27T14:45:27.169Z d5dbd88a-2172-4359-b835-73c799932818 INFO /aws/lambda/diego-sit-direct
...
As far as I'm aware, the pattern just shouldn't match any of these log group names.
Is there anything else I can give you to help you debug?
You mentioned upgrading from v2, do you get similar results for v2 as well, and are these all the log groups present ?
You mentioned upgrading from v2, do you get similar results for v2 as well, and are these all the log groups present ?
With v2 it works correctly so these log groups get filtered out. It's in the same AWS account using the same string as a filter so I think I should be seeing identical behaviour.
Checkboxes for prior research
Describe the bug
Since trying to update my application from using v2 of the SDK to v3, the
logGroupNamePattern
field forDescribeLogGroupsCommand
returns log groups that do not match the given stringSDK version number
@aws-sdk/client-cloudwatch-logs 3.418.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
NodeJS v18.18.0
Reproduction Steps
Using the following code in an environment where there are log groups that match the given pattern and also log groups that do not:
Observed Behavior
The log groups with the following names are returned:
Expected Behavior
I would expect none of the following log group names to be returned:
Possible Solution
No response
Additional Information/Context
No response