There are several ways for exporting logs from CloudWatch in searchable text format:
The easiest way of downloading logs in text format is to go to a log group -> Select a log stream -> go to Actions and select Download search results as CSV:
This will download the logs in a
.csv format which may or may not be what we want, nevertheless I think it is good for searching a analysis.
A more involved way to export logs would be to select a log group and from the Actions and for that log group select Export Data to S3:
This may export every stream from the log group to an S3 bucket, from which we can download the logs in text format. In order to be able to write to an S3 bucket, we need a policy. There is a full documentation on the AWS docs about how to do this.
I need to mention the CloudWatch provides a way to analyze logs without being able to export them by using CloudWatch Logs Insights. CloudWatch Logs Insights has its own query language.