简体   繁体   中英

Logs in exist in the AWS cloudwatch but does not return the logs

Here is my code, used with filterLogEvents function for filter the logs, but does not retun the logs.

let params = {
        logGroupName : 'xxxx',
        filterPattern: '{ $.notification.messageId = "d890f718-5f1a-5b1c-9694-a141de3101bs" }'
    };
    cloudWatchLogs.filterLogEvents(params, function(err, data) {
        if (err) console.log(err, err.stack); // an error occurred
        else     console.log(data.events);           // successful response
    });

And here is the response when running the function [] (empty array. but logs is exists in the cloudwatch)

Can you that try

await cloudWatchLogs.filterLogEvents(params, function(err, data) {
            if (err) console.log(err, err.stack); // an error occurred
            else     console.log(data.events); // successful response
        }).promise();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM