Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
693 views
in Technique[技术] by (71.8m points)

amazon web services - AWS Cloudwatch Insights how to query using multiple log groups

Reading the documentation seems that is possible in AWS Cloudwatch to run queries with multiple log groups but I can not see any example on how to do it.

I would like to join two log groups using common attributes and select some logs using filter.

Has anyone run into the same problem and found a solution? Thanks in advance.

question from:https://stackoverflow.com/questions/65905013/aws-cloudwatch-insights-how-to-query-using-multiple-log-groups

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you are talking about AWS Console, the option to select multiple log groups is a checkbox and you can select over 20 log groups. AWS CloudWatch Insights Console

If you refer to the AWS CLI, you can also choose multiple log groups. First create the query (in one or more log groups) (https://docs.aws.amazon.com/cli/latest/reference/logs/start-query.html) and then get the results (https://docs.aws.amazon.com/cli/latest/reference/logs/get-query-results.html)

Example:

Query creation with multiple log groups:

aws logs start-query --log-group-names "/aws/apigateway/welcome" "/aws/lambda/Test01" 
--start-time 1598936400000 --end-time 1611464400000 --query-string "fields @timestamp, 
@message"

Recover result from created query:

aws logs get-query-results --query-id <query_id>

AWS CLI CloudWatch Insights


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...