Skip to content
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

client-cloudwatch-logs doesn't return some logs #6753

Open
3 of 4 tasks
mike-bridgefy opened this issue Dec 20, 2024 · 1 comment
Open
3 of 4 tasks

client-cloudwatch-logs doesn't return some logs #6753

mike-bridgefy opened this issue Dec 20, 2024 · 1 comment
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@mike-bridgefy
Copy link

Checkboxes for prior research

Describe the bug

When using the node library, data stored in cloudwatch is obtained, however it does not return the required information
package.json
... "dependencies": { "@aws-sdk/client-cloudwatch-logs": "^3.716.0", ...
We use log levels and when we try to return the logs of type "ERROR" the script returns an empty array, however if I do the same with type "INFO" it does return the information
Script

    const logs = await this._clientLogs.send(
      new FilterLogEventsCommand({
        logGroupName,
        logStreamNames,
        // filterPattern,
        filterPattern: '{$.logLevel="E*"}',
        startTime,
        endTime,
      }),
    );

If the same filter is performed in the AWS cloudwatch console, the information is returned correctly

fields @timestamp, @message, @logStream as username
| filter logLevel="ERROR"
| sort @timestamp desc
| limit 10000

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

20.12.1

Reproduction Steps

Try to make similar filters using the library and you will see that it does not return complete information

Observed Behavior

Using the package returns different information than in the AWS console when it should be the same

Expected Behavior

We expect the same behavior by doing the filters in the library and in the AWS console

Possible Solution

No response

Additional Information/Context

No response

@mike-bridgefy mike-bridgefy added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 20, 2024
@aBurmeseDev
Copy link
Member

Hi @mike-bridgefy - thanks for reaching out.

Before we further investigate, could you try these expressions below?

// This filter pattern uses the JSON notation to specify the field name logLevel and checks if its value is exactly equal to the string "ERROR". 
filterPattern: '{ $.logLevel = "ERROR" }'

// This checks if the logLevel field starts with the letter "E" and is followed by any other characters. This pattern will match log events with log levels like "ERROR", "EMERGENCY", "EWARN", etc.
filterPattern: "?logLevel = /E.*/"

// This checks if the logLevel field exactly matches the string "ERROR". This pattern will only match log events with the log level "ERROR" and will not match log levels like "ERRORWARN" or "EMERROR".
filterPattern: "?logLevel = /ERROR/"

@aBurmeseDev aBurmeseDev self-assigned this Dec 21, 2024
@aBurmeseDev aBurmeseDev added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants