I have created an AWS CloudWatch log group with a name which was not very future proof. Is it possible to rename such a log group? I could find no option to do this via the CloudWatch console.
I guess an alternative would be to export the content of the log group, create a new log group with the desired name, and then re-consume the exported logs to the new log group. I would prefer to avoid this approach though, as (apart from being tedious) this would reset the ingestionTime
of all the log events in the log group.
It does not seem to be possible at the current time. The AWS CLI only lists the following log-group
-related actions at this time:
My solution, since the log-group was only recently created and all the original log files were still on the EC2 instance, was to:
$ /etc/init.d/awslogs stop
. /var/awslogs/etc/awslogs.conf
on the EC2 instance to specify the desired log group name instead of the previous one. $ /etc/init.d/awslogs start
. Quite the tedious procedure, especially with having to manually move the log files, one at a time, in the correct order. Would be neat if there was functionality in the future to rename a log group.
A "solution" ...
Create the new log group. Have the streams write to this log group. Using aws cli get the events for each of the streams for the old log group and then put them to the new group.
I've got about 2,000 streams I'm about to do this too. We restructured are group names.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.