我正在使用AWS Cloudwatch Insights并运行如下查询:
public function scopeTopFeatures(Builder $query, $topFeatureIds): Builder
{
return $query->whereHas('features', function (Builder $query) use ($topFeatureIds) {
$query->whereIn('vehicle_feature_id', $topFeatureIds);
});
}
但是,在最后一行,出现以下错误:
fields @message, @timestamp
| filter strcontains(@message, "Something of interest happened")
| stats count() as interestCount by bin(10m) as tenMinuteTime
| stats max(interestCount) by datefloor(tenMinuteTime, 1d)
由此看来,这意味着我无法在Insights中进行多层统计查询,因此无法进行统计。有办法解决吗?
答案 0 :(得分:4)
您当前无法使用多个stat命令,据我所知,目前尚无直接方法。但是,您可以加厚单个stat命令并以逗号分隔,如下所示:
MenuItem
您定义字段并在fields @message, @timestamp
| filter strcontains(@message, "Something of interest happened")
| stats count() as @interestCount,
max(interestCount) as @maxInterest,
interestCount by bin(10m) as @tenMinuteTime
之后使用函数,然后处理这些结果字段。