无法调用 start_query 方法
我正在尝试使用以下代码查询 cloudwatch 日志。但我得到以下错误
TypeError: cloudwatchlogs.startQuery
不是函数
API 似乎无法找到 startQuery 方法。请帮我解决问题。
var AWS = require('aws-sdk');
var cloudwatchlogs = new AWS.CloudWatchLogs({apiVersion: '2014-03-28',
region: 'us-west-2'
});
// Set the region
exports.handler = (event,context,callback) => {
console.log("hai");
AWS.config.update({region: 'us-west-2'});
var params = {
endTime: 1553686248, /* required */
logGroupName: '/aws/lambda/tset', /* required */
queryString: 'fields @message| filter @message like /START/| fields strcontains(@message, "$LATEST") as @CONTAINS_ap | stats sum(@CONTAINS_ap) as @sample',
startTime: 1553538648,
limit: 0
};
cloudwatchlogs.startQuery(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
}