AWS CloudWatch Logs Insights 可以使用 concat 函数连接两个或多个字段的值。以下是一个示例查询,将字段 client_ip 和 request_id 的值连接在一起。
fields @timestamp, @message
| filter @message like /error/
| sort @timestamp desc
| limit 20
| stats count(*) as count by client_ip, request_id
| sort count desc
| limit 100
| concat client_ip, ' : ', request_id as cid
| display count, cid
在此查询中,将字段 client_ip 和 request_id 的值连接在一起,并将其命名为 cid。使用 display 子句显示 cid 和 count 值。