Can wildcards be used to specify log groups in the CreateExportTask API for CloudWatch Logs?
The issue
I am considering a method to export CloudWatch Logs using the CreateExportTask API.
Since there are multiple log groups I want to export, I would like to specify them all at once, but can wildcards be used to specify log groups in the CreateExportTask API?
The solution
No, wildcards cannot be used.
In the request parameter "logGroupName" of the CreateExportTask API, the following patterns can be defined, but wildcards (*
) are not included.
Pattern: [.-_/#A-Za-z0-9]+
Since wildcards cannot be used, please consider specifying each log group name in multiple schedules.
Also, please note that there is a quota of one export task per account, so concurrent execution is not possible.
Therefore, you need to execute tasks at intervals.
Export task
One active (running or pending) export task at a time, per account. This quota can't be changed.
Note
Since continuous log archiving using the CreateExportTask API is deprecated, please consider using subscriptions if continuous archiving is required.
CreateExportTask - Amazon CloudWatch Logs
We recommend that you don't regularly export to Amazon S3 as a way to continuously archive your logs. For that use case, we instaed recommend that you use subscriptions.