Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do we sort CloudWatch stream logs by 'most recent' in AWS console?

Is there a way to filter CloudWatch log streams by 'most recent' to oldest within the AWS console? I am having to scroll incredibly far down to get to my most recent log messages.

I have tried filtering by 30s - 5mins which works for now, I just thought there may be an easier way to list all of the log streams starting with most recent at the top instead of oldest.

like image 995
Cody Mitchell Avatar asked Feb 02 '19 00:02

Cody Mitchell


People also ask

How do you organize CloudWatch logs?

Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/ . In the navigation pane, choose Log groups. Choose Actions, and then choose Create log group. Enter a name for the log group, and then choose Create log group.

How do I filter CloudWatch logs by timestamp?

Currently, CloudWatch Logs Insights doesn't support filtering logs with human readable timestamps. Use general functions in the fields and filter commands and as arguments for other functions. Use IP address string functions in the filter and fields commands and as arguments for other functions.

How do I run a query in CloudWatch?

To run a CloudWatch Logs Insights sample queryIn the navigation pane, choose Logs, and then choose Logs Insights. On the Logs Insights page, the query editor contains a default query that returns the 20 most recent log events. In the Select log group(s) drop down, choose one or more log groups to query.


1 Answers

I had the same problem.

Just use CloudWatch Logs Insights.

screenshot

You should have a sample query provided by Amazon, but the one below works perfectly.

fields @timestamp, @message
| sort @timestamp desc
| limit 200
like image 197
Adam Tomaszewski Avatar answered Oct 19 '22 03:10

Adam Tomaszewski